jeanboydev / Android-CropView

Android兼容行很强很方便的图片裁切库,几行代码就可实现拍照裁切,选择图片裁切,支持旋转,自定义比例。
Apache License 2.0
59 stars 13 forks source link

适配7.0拍照 #1

Closed 7449 closed 6 years ago

7449 commented 7 years ago

pickFromCamera 改成这样

    int version = android.os.Build.VERSION.SDK_INT;
    if (version < 24) {
        cropperHandler.getActivity().startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).
                        putExtra(MediaStore.EXTRA_OUTPUT, cameraCacheUri),
                CropperParams.REQUEST_PICK_CAMERA);
    } else {
        ContentValues contentValues = new ContentValues(1);
        contentValues.put(MediaStore.Images.Media.DATA, cameraCacheUri.getPath());
        contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
        Uri uri = cropperHandler.getActivity().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
        cropperHandler.getActivity().startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).
                putExtra(MediaStore.EXTRA_OUTPUT, uri), CropperParams.REQUEST_PICK_CAMERA);
    }
jeanboydev commented 7 years ago

好的 感谢您的建议

494928699 commented 7 years ago

如果不想配置裁剪比列 怎么办?

jeanboydev commented 7 years ago

@494928699 更新下代码,使用

@Override
    public CropperParams getParams() {
        //不约束裁切比例都传入0
        return new CropperParams(0, 0);
    }
fuyundahai commented 6 years ago

裁剪速度很慢怎么办,cpu使用率只有14-15%

7449 commented 6 years ago

Album,用这个吧,用的Ucrop,自己可以设置options