How to use uCrop and RxPaparazzo

791 Views Asked by At

I'm using this library to crop my images.

https://github.com/Yalantis/uCrop

to take images:

https://github.com/miguelbcr/RxPaparazzo

To use this library,I'm using RxPaparazzo:

UCrop.Options options = new UCrop.Options();
            options.setShowCropFrame(true);
            options.setToolbarColor(ContextCompat.getColor(getActivity(), R.color.colorPrimaryDark));
            options.setMaxBitmapSize(1000000000);

            size = Size.Small;
            RxPaparazzo.takeImage(this)
                    .crop(options)
                    .size(size)
                    .usingGallery()
                    .subscribe(new Action1<com.fuck_boilerplate.rx_paparazzo.entities.Response<NewDiary, String>>() {
                        @Override
                        public void call(com.fuck_boilerplate.rx_paparazzo.entities.Response<NewDiary, String> response) {
                            if (response.resultCode() != Activity.RESULT_OK) {
                                response.targetUI().showUserCanceled();
                                return;
                            }

                            response.targetUI().loadImage(response.data());
                        }
                    });

now,I want to use withAspectRatio(16, 9) function but I don't know how can I use?

options.withAspectRatio(16, 9) // not work
------------
 RxPaparazzo.takeImage(this)
                        .crop(options)
.withAspectRatio(16, 9) // not work
1

There are 1 best solutions below

0
On

You can use options.setAspectRatioOptions(...) or options.setAspectRatio(...) instead withAspectRatio(...).