PS. This repository is just for testing jCenter.
0.2.1
Include the library as local library project (Gradle or Maven choose one).
- Gradle:
compile 'com.moinut:picrop:0.2.1'
- Maven:
<dependency>
<groupId>com.moinut</groupId>
<artifactId>picrop</artifactId>
<version>0.2.1</version>
<type>pom</type>
</dependency>
You can look at the Sample Project - sample.
- Use PiCrop in
Activity
orFragment
orFragment-v4
.
PiCrop piCrop = new PiCrop(this);
- To load and crop picture with callback.
FROM_ALBUM
: Choose picture from album to crop
FROM_CAMERA
: Take photo to crop
piCrop.get(PiCrop.FROM_ALBUM /*OR: PiCrop.FROM_CAMERA*/, new OnCropListener() {
@Override
public void onStart() {
// When PiCrop start working. You can do something like show a progressbar.
}
@Override
public void onSuccess(Uri picUri) {
// Done. The picUri is the cropped picture's uri. It's something you want!
}
@Override
public void onError(String errorMsg) {
// Error :(
}
});
- Override onActivityResult method and handle PiCrop result.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
piCrop.onActivityResult(requestCode, resultCode, data);
}
Copyright (c) 2016 MOILING
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.