diff --git a/README.md b/README.md index 5b26afe2..062479fa 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ For more information, see the [GitHub Wiki](https://github.com/ArthurHub/Android - Try solve manifest merger issue by adding `transitive` flag #405 (thx @j-garin) - Use thread pool executors for async image loading and cropping operations to prevent app hang if default executor is busy (thx @ruifcardoso) - Fix image rotation breaking min/max crop result restrictions #401 +- Propagate all extra data set on start crop activity intent back in crop result intent #352 *2.5.0* - Update to sdk v26 diff --git a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java index 482cf959..56a08f9f 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java @@ -66,6 +66,9 @@ public final class CropImage { /** The key used to pass crop image options to {@link CropImageActivity}. */ public static final String CROP_IMAGE_EXTRA_OPTIONS = "CROP_IMAGE_EXTRA_OPTIONS"; + /** The key used to pass crop image bundle data to {@link CropImageActivity}. */ + public static final String CROP_IMAGE_EXTRA_BUNDLE = "CROP_IMAGE_EXTRA_BUNDLE"; + /** The key used to pass crop image result data back from {@link CropImageActivity}. */ public static final String CROP_IMAGE_EXTRA_RESULT = "CROP_IMAGE_EXTRA_RESULT"; @@ -469,7 +472,7 @@ public Intent getIntent(@NonNull Context context, @Nullable Class cls) { Bundle bundle = new Bundle(); bundle.putParcelable(CROP_IMAGE_EXTRA_SOURCE, mSource); bundle.putParcelable(CROP_IMAGE_EXTRA_OPTIONS, mOptions); - intent.putExtra(CropImageOptions.BUNDLE_KEY, bundle); + intent.putExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE, bundle); return intent; } diff --git a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java index 7ccafdd3..c313da4d 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java @@ -59,7 +59,7 @@ public void onCreate(Bundle savedInstanceState) { mCropImageView = findViewById(R.id.cropImageView); - Bundle bundle = getIntent().getBundleExtra(CropImageOptions.BUNDLE_KEY); + Bundle bundle = getIntent().getBundleExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE); mCropImageUri = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_SOURCE); mOptions = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS); @@ -325,6 +325,7 @@ protected Intent getResultIntent(Uri uri, Exception error, int sampleSize) { mCropImageView.getWholeImageRect(), sampleSize); Intent intent = new Intent(); + intent.putExtras(getIntent()); intent.putExtra(CropImage.CROP_IMAGE_EXTRA_RESULT, result); return intent; } diff --git a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java index 42abd24b..240fe9b3 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java @@ -29,8 +29,6 @@ */ public class CropImageOptions implements Parcelable { - static final String BUNDLE_KEY = "bundle"; - public static final Creator CREATOR = new Creator() { @Override diff --git a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java index ee10c9f0..46cb1f33 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java @@ -185,7 +185,7 @@ public CropImageView(Context context, AttributeSet attrs) { CropImageOptions options = null; Intent intent = context instanceof Activity ? ((Activity) context).getIntent() : null; if (intent != null) { - Bundle bundle = intent.getBundleExtra(CropImageOptions.BUNDLE_KEY); + Bundle bundle = intent.getBundleExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE); if (bundle != null) { options = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS); }