Android MediaStore Crop feature, how to make selection arrows always visible?

I am working on an image picker / crop program and using this code below:

http://www.androidworks.com/crop_large_photos_with_android/comment-page-1#comment-969

As I understand it, we are setting properties with additional functionality added to our intent like the code below.

To change the marquee we need to touch the border and then the arrows become visible, but what I want to do is make them always visible because it's hard to figure out how the user understands this. The Instagram Android app does it this way, so I guess there is a way to do it.

Thank.

Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
                intent.setType("image/*");
                intent.putExtra("crop", "true");
                intent.putExtra("aspectX", aspectX);
                intent.putExtra("aspectY", aspectY);
                intent.putExtra("outputX", outputX);
                intent.putExtra("outputY", outputY);
                intent.putExtra("scale", scale);
                intent.putExtra("return-data", return_data);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());

      

Edit / Solve: Thanks to @Renard, I found a solution like this:

I used this gallery source code: http://gitorious.org/0xdroid/packages_apps_gallery3d/trees/3c02f2877dc2f8f0b5c01d03fa2b487c040e4000

I've also tried using a different gallery resource code, but this is the easiest way to maintain.

You just need to remove the following if you checked the Highlightview.java function of the draw () class:

if (mMode == ModifyMode.Grow)  

      

When you do this it works, but the arrows move as you move and to avoid that you need to change the moveBy () last method, which:

mContext.invalidate(invalRect);

      

with this:

mContext.invalidate();

      

+3


source to share


1 answer


Yes, there is a way. But it’s not easy.

Check out the source code for the Gallery app. Specifically HighlightView.java. You will see that the method responsible for drawing the arrows is only called when the user touches the borders. Therefore, you need to grab the source code of the CropImage action. include it in your application and change the draw () method of HighlightView.java to always call drawResizeDrawables ().



The advantage of this is that you can be sure that the cropping intent will work on all devices, even if they have a custom gallery that does not support cropping intent.

+1


source







All Articles