-
Notifications
You must be signed in to change notification settings - Fork 236
Cannot load file into cropView #6
Comments
@rohanmahale is PrismApp your own app? Or is a third-party app like Gallery? I'd start by making sure your app has read permission on that file. If you do, to help us debug this please try loading that file on a regular |
Yup. I am using Glide. Prism is the name of my app. |
@rohanmahale cool, can you please try loading that file into a regular |
Yup..Done that. I can load images using glide both into regular image views as well as the crop view using Glide.with(...).load(...).into(...) |
The idea was to launch my own intent to select a picture and then move onto the cropping activity i.e passing the data(uri or path string) as an extra via an intent to the cropping activity. Is it not possible to do this right now? I'm sure using
works. |
@rohanmahale can you please send us a sample image for us to reproduce? evelio@lyft.com also what device are you using? |
@eveliotc . I am using a Xiaomi Redmi 2. I dont think it has anything to do with the image. Ok this is what I was trying to do. In my current activity I launch my own intent to pick an image either from the Gallery/Google Photos. On Picking that image I was getting the Uri which I would convert to a file path and pass to my CropImageActivity as an extra. In CropImageActivity I was using the
I even kept a static Uri object in this activity, set it and then tried to load it. Neither method worked. (I was trying to load without using the pickUsing() method ) |
private void resetTouchManager() {
final boolean invalidBitmap = bitmap == null;
final int bitmapWidth = invalidBitmap ? 0 : bitmap.getWidth();
final int bitmapHeight = invalidBitmap ? 0 : bitmap.getHeight();
touchManager.resetFor(bitmapWidth, bitmapHeight, getWidth(), getHeight());
} when load File to it, getWidth getHeight or getMeasured , come back zero |
I have the same problem, if trying to use pickUsing(), the image loads. If not it will not load. If I set the view to ImageView it loads. |
Ok I solved this by using a ViewTreeObserver combined with this commit: |
@juliusspencer . What was the purpose of the ViewTreeObserver? Could you elaborate? Also I'm guessing you've downloaded and added the library project separately and not just using it as a gradle |
Yes I have pulled it down and made the modifications as per the pull request, then deployed to my own Synology server. I used the ViewTreeObserver because Picasso (in my case) didn't seem to end up loading the image into the CropView. As soon as I used the ViewTreeObserver to wait for things to load it loaded the Image from the intent. I've been passing the Uri through as a Parcelable. Hope that helps. :) |
@juliusspencer Yup that definitely helps. Thanks! Could you show me the snippet of the ViewTreeoObserver portion . Do you load the image into the cropView in the onGlobalLayout callback(OnGlobalLayoutListener)? |
Yes that's correct:
|
@rohanmahale @Modificator issue is to call As it seems a common pitfall I'll add a fix and deploy a new version shortly. |
Thanks @eveliotc . I use AndroidAnnotations. So I am currently loading it in a method annotated with @AfterViews. |
@rohanmahale @Modificator @juliusspencer can you please use try #16 should be on latest snapshot:
Also you might have to add sonatype snapshots to your repository:
|
@rohanmahale @Modificator @juliusspencer did you get the chance of trying out that patch/snapshot? |
@eveliotc I just tried it out. It seems to be working fine. |
Fixes #6 Defer load until first layout pass
@rohanmahale thanks! |
👍 |
Hi @davidbeloosesky , @eveliotc
I am trying to load an image into the cropview but it does not show up. I pass a string extra to my crop image activity.
I then try to load it into the cropview using the following
The value of the string on debugging is
Why does the image not show up? Am I using the api wrong or is it a bug?
I have even tried removing the Uri.fromFile bit and directly loading a File.
I am not using the
Instead, I am using my own intent and request code to launch my CropImageActivity before returning to my current activity.
The text was updated successfully, but these errors were encountered: