如何使用uCrop和RxPaparazzo

时间:2017-03-13 08:32:44

标签: android ucrop

我正在使用此库裁剪我的图片。

https://github.com/Yalantis/uCrop

拍摄照片:

https://github.com/miguelbcr/RxPaparazzo

要使用此库,请使用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());
                        }
                    });

现在,我想使用withAspectRatio(16, 9)功能,但我不知道如何使用?

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

1 个答案:

答案 0 :(得分:0)

您可以使用options.setAspectRatioOptions(...)options.setAspectRatio(...)代替withAspectRatio(...)