diff --git a/main/src/com/polites/android/GestureImageView.java b/main/src/com/polites/android/GestureImageView.java index 9a70ce4..9230c13 100644 --- a/main/src/com/polites/android/GestureImageView.java +++ b/main/src/com/polites/android/GestureImageView.java @@ -162,6 +162,16 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(displayWidth, displayHeight); } + /** + * View reusing fix borrowed from + * https://github.com/jasonpolites/gesture-imageview/issues/64 + * and slightly modified to match code conventions. + */ + private void resetForNextImage() { + layout = false; + startingScale = -1.0f; + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); @@ -376,6 +386,8 @@ protected void onDetachedFromWindow() { } protected void initImage() { + resetForNextImage(); + if(this.drawable != null) { this.drawable.setAlpha(alpha); this.drawable.setFilterBitmap(true);