Skip to content

Commit 5fb46a6

Browse files
committed
Propagate all extra data set on start crop activity intent back in crop result intent #352
1 parent 0e923fc commit 5fb46a6

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ For more information, see the [GitHub Wiki](https://github.com/ArthurHub/Android
125125
- Try solve manifest merger issue by adding `transitive` flag #405 (thx @j-garin)
126126
- Use thread pool executors for async image loading and cropping operations to prevent app hang if default executor is busy (thx @ruifcardoso)
127127
- Fix image rotation breaking min/max crop result restrictions #401
128+
- Propagate all extra data set on start crop activity intent back in crop result intent #352
128129

129130
*2.5.0*
130131
- Update to sdk v26

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public final class CropImage {
6666
/** The key used to pass crop image options to {@link CropImageActivity}. */
6767
public static final String CROP_IMAGE_EXTRA_OPTIONS = "CROP_IMAGE_EXTRA_OPTIONS";
6868

69+
/** The key used to pass crop image bundle data to {@link CropImageActivity}. */
70+
public static final String CROP_IMAGE_EXTRA_BUNDLE = "CROP_IMAGE_EXTRA_BUNDLE";
71+
6972
/** The key used to pass crop image result data back from {@link CropImageActivity}. */
7073
public static final String CROP_IMAGE_EXTRA_RESULT = "CROP_IMAGE_EXTRA_RESULT";
7174

@@ -469,7 +472,7 @@ public Intent getIntent(@NonNull Context context, @Nullable Class<?> cls) {
469472
Bundle bundle = new Bundle();
470473
bundle.putParcelable(CROP_IMAGE_EXTRA_SOURCE, mSource);
471474
bundle.putParcelable(CROP_IMAGE_EXTRA_OPTIONS, mOptions);
472-
intent.putExtra(CropImageOptions.BUNDLE_KEY, bundle);
475+
intent.putExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE, bundle);
473476
return intent;
474477
}
475478

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void onCreate(Bundle savedInstanceState) {
5959

6060
mCropImageView = findViewById(R.id.cropImageView);
6161

62-
Bundle bundle = getIntent().getBundleExtra(CropImageOptions.BUNDLE_KEY);
62+
Bundle bundle = getIntent().getBundleExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE);
6363
mCropImageUri = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_SOURCE);
6464
mOptions = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS);
6565

@@ -325,6 +325,7 @@ protected Intent getResultIntent(Uri uri, Exception error, int sampleSize) {
325325
mCropImageView.getWholeImageRect(),
326326
sampleSize);
327327
Intent intent = new Intent();
328+
intent.putExtras(getIntent());
328329
intent.putExtra(CropImage.CROP_IMAGE_EXTRA_RESULT, result);
329330
return intent;
330331
}

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*/
3030
public class CropImageOptions implements Parcelable {
3131

32-
static final String BUNDLE_KEY = "bundle";
33-
3432
public static final Creator<CropImageOptions> CREATOR =
3533
new Creator<CropImageOptions>() {
3634
@Override

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public CropImageView(Context context, AttributeSet attrs) {
185185
CropImageOptions options = null;
186186
Intent intent = context instanceof Activity ? ((Activity) context).getIntent() : null;
187187
if (intent != null) {
188-
Bundle bundle = intent.getBundleExtra(CropImageOptions.BUNDLE_KEY);
188+
Bundle bundle = intent.getBundleExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE);
189189
if (bundle != null) {
190190
options = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS);
191191
}

0 commit comments

Comments
 (0)