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 40ce3725..00118462 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java @@ -454,10 +454,10 @@ public Intent getIntent(@NonNull Context context, @Nullable Class cls) { Intent intent = new Intent(); intent.setClass(context, cls); - Bundle b = new Bundle(); - b.putParcelable(CROP_IMAGE_EXTRA_SOURCE, mSource); - b.putParcelable(CROP_IMAGE_EXTRA_OPTIONS, mOptions); - intent.putExtra("bundle", b); + Bundle bundle = new Bundle(); + bundle.putParcelable(CROP_IMAGE_EXTRA_SOURCE, mSource); + bundle.putParcelable(CROP_IMAGE_EXTRA_OPTIONS, mOptions); + intent.putExtra(CropImageOptions.BUNDLE_KEY, 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 c918a2d9..8de4b74b 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageActivity.java @@ -64,7 +64,7 @@ public void onCreate(Bundle savedInstanceState) { mCropImageView = (CropImageView) findViewById(R.id.cropImageView); - Bundle bundle = getIntent().getBundleExtra("bundle"); + Bundle bundle = getIntent().getBundleExtra(CropImageOptions.BUNDLE_KEY); mCropImageUri = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_SOURCE); mOptions = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS); 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 6e7d92b4..fe64e812 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageOptions.java @@ -29,6 +29,8 @@ */ public class CropImageOptions implements Parcelable { + static final String BUNDLE_KEY = "bundle"; + public static final Creator CREATOR = new Creator() { @Override public CropImageOptions createFromParcel(Parcel in) { 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 5d22d466..c939c538 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java @@ -227,7 +227,10 @@ public CropImageView(Context context, AttributeSet attrs) { CropImageOptions options = null; Intent intent = context instanceof Activity ? ((Activity) context).getIntent() : null; if (intent != null) { - options = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_OPTIONS); + Bundle bundle = intent.getBundleExtra(CropImageOptions.BUNDLE_KEY); + if (bundle != null) { + options = bundle.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS); + } } if (options == null) { diff --git a/quick-start/src/main/java/com/theartofdev/edmodo/cropper/quick/start/MainActivity.java b/quick-start/src/main/java/com/theartofdev/edmodo/cropper/quick/start/MainActivity.java index fec7efe0..ed744b51 100644 --- a/quick-start/src/main/java/com/theartofdev/edmodo/cropper/quick/start/MainActivity.java +++ b/quick-start/src/main/java/com/theartofdev/edmodo/cropper/quick/start/MainActivity.java @@ -37,6 +37,8 @@ public void onSelectImageClick(View view) { CropImage.activity() .setGuidelines(CropImageView.Guidelines.ON) .setActivityTitle("My Crop") + .setCropShape(CropImageView.CropShape.OVAL) + .setRequestedSize(400, 400) .start(this); }