Skip to content

chihane/PickerChu

Repository files navigation

#PickerChu

PickerChu is an image pick-and-crop library for Android pika.

##Integration

Simply add the following line to the dependencies section of your build.gradle file:

compile 'mlxy.pickerchu:pickerchu:1.1.2'

##For Eclipse users

Just copy and paste all files from /PickerChu/src/main/java/mlxy/pickerchu to anywhere in your src folder, that'll work too.

Although I highly recommend you to migrate your Android projects to Android Studio.

##Usage

  1. Build a PickerChu in your code:

    pickerChu = new PickerChu.Builder(this)
                            .needToCrop(true)
                            .saveIn(getExternalCacheDir())
                            .byAspectRatioOf(1, 1)
                            .inSizeOf(1024, 1024)
                            .onImageCropped(new PickerChu.OnImageCroppedListener() {
                                @Override
                                public void onImageCropped(Uri imageUri) {
                                    // imageView.setImageURI(imageUri);
                                }
                            })
                            .build();

    Note: You may not need all of those builder methods above, see JavaDoc for more details.

  2. Handle onActivityResult() event:

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        this.pickerChu.handleActivityResult(requestCode, resultCode, data);
    }
  3. Choose a way to get a picture:

    pickerChu.pickPicture();

    or:

    pickerChu.takePhoto();
  4. Enjoy :)

##Author

Chihane Habana

##License

The MIT License (MIT)