return cropped image width/height in onActivityResult
suau opened this issue · 5 comments
it would be great if the cropped ActivityResult would contain the final cropped image width and height as well, the data is already available in BitmapCropTask
and just needs to be passed through to the BitmapCroppedCallback.
As none of the internals are exposed by this library, I think it's acceptable to change the interface of BitmapCroppedCallback.
need it, too. Because i just need the final cropped Rect,so will you support it ? Thanks.
Thanks for the issue. I've added this info to the ActivityResult bundle, available in the next library update soon.
Please check the latest uCrop version
Now you can choose between:
Lightweight general solution
compile 'com.yalantis:ucrop:2.2.0'
Get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
compile 'com.yalantis:ucrop:2.2.0-native'
@shliama I have download the latest version and tested,it works well.Thank you.
Here is what i add for the new api:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
int width = data.getIntExtra(UCrop.EXTRA_OUTPUT_IMAGE_WIDTH, defaultValue);
int height = data.getIntExtra(UCrop.EXTRA_OUTPUT_IMAGE_HEIGHT, defaultValue);
} else if (resultCode == UCrop.RESULT_ERROR) {
Throwable cropError = UCrop.getError(data);
}
}
resolved