I found this bug when try to set bitmap from image file that was recently shooted via camera. In this case my nexus 5x needs few seconds to render this bitmap to imageview, and looks like ZoomableImageView can't wait this time. Image never showed(except cases when I add breakepoints to it).
So, some details about problem in ZoomableImageView .
When inner image render with delay ZoomableImageView can change flag imageRenderedAtLeastOnce to true, but prevMatchViewSize will be with 0 values(because image is physically not rendered yet). And this params will broke method translateMatrixAfterRotate() (yep, divide by zero and Float.NaN as result), and after that our imgMatrix will contain NaN values.
Right now I fix it with changing logic in fitImageToView()
if (!isZoomed && !imageRenderedAtLeastOnce)
to
if ((!isZoomed && !imageRenderedAtLeastOnce) || (prevMatchViewSize.width == 0.0f && prevMatchViewSize.height == 0.0f))
and removing(because in new logic this will never be invoked)
if (prevMatchViewSize.width == 0.0f || prevMatchViewSize.height == 0.0f) { savePreviousImageValues() }
I found this bug when try to set bitmap from image file that was recently shooted via camera. In this case my nexus 5x needs few seconds to render this bitmap to imageview, and looks like ZoomableImageView can't wait this time. Image never showed(except cases when I add breakepoints to it).
So, some details about problem in ZoomableImageView . When inner image render with delay ZoomableImageView can change flag imageRenderedAtLeastOnce to true, but prevMatchViewSize will be with 0 values(because image is physically not rendered yet). And this params will broke method translateMatrixAfterRotate() (yep, divide by zero and Float.NaN as result), and after that our imgMatrix will contain NaN values.
Right now I fix it with changing logic in fitImageToView()
if (!isZoomed && !imageRenderedAtLeastOnce)
toif ((!isZoomed && !imageRenderedAtLeastOnce) || (prevMatchViewSize.width == 0.0f && prevMatchViewSize.height == 0.0f))
and removing(because in new logic this will never be invoked)
if (prevMatchViewSize.width == 0.0f || prevMatchViewSize.height == 0.0f) { savePreviousImageValues() }