From 029fb16601061436b95524f10775c679464ba9ec Mon Sep 17 00:00:00 2001 From: Raegdan Date: Wed, 16 Sep 2015 14:34:25 +0300 Subject: [PATCH] Fix proposed in https://github.com/jasonpolites/gesture-imageview/issues/64 is working fine, so I applied it. --- main/src/com/polites/android/GestureImageView.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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);