Open jcogilvie opened 12 years ago
Confirming first point above. ImageView disapears when drawable/bitmap is changed with e.g. setImageBitmap().
Did anyone ever manage to resolve this issue? I.e. when the image is changed with SetImageBitmap, the imageview dissapears?
@svt dragon....100/100 for second point. Was experiencing the same issue and ur soln worked like magic.
I just updated to the latest version from your repository for the scaleType support, and it broke a couple of things:
1) if I set an image to a preview (e.g., a loading image) and then set it to a real image, the second image never shows up. I fixed this by forcing "layout = false" when the image changes. I also had to reset startingScale = -1.0f but for production you'd probably have to check if startingScale had been set in the xml or by your own code.
2) the orientation detection (landscape vs. portrait) isn't sufficient to cause the image to be fully on the screen; at least, not for scaleType = fitCenter. For example, I have a "landscape" image and a "landscape" phone, but the image's height (the shorter dimension) is slightly larger than my phone's height. However, due to the orientation checking in the GestureImageView, the image is fit based on its width, which causes the top and bottom to appear cut off, instead of having vertical, black bars on the left and right edges and showing me the whole image. I had this working before I adopted your latest changes; when it was working, my setupCanvas function was this:
I think the line you care about is the one about math.min().
In the latest version, if I change the following in computeStartingScale():
...then it starts out scaled correctly, but if I zoom out, it resets to the no-vertical-bars zoom.
If I then take that value and assign it to both fitScaleHorizontal and fitScaleVertical (in effect, replacing them both with it--I called it fitScaleAbs) in both the view and the gesture listener, then it works as expected.