diff --git a/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoView.java b/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoView.java index 8a8ba0a7..7479e741 100644 --- a/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoView.java +++ b/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoView.java @@ -150,6 +150,10 @@ public void setZoomable(boolean zoomable) { attacher.setZoomable(zoomable); } + public void setSupportSecondDoubleTap(boolean enable) { + attacher.setSupportSecondDoubleTap(enable); + } + public RectF getDisplayRect() { return attacher.getDisplayRect(); } diff --git a/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoViewAttacher.java b/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoViewAttacher.java index 18f1744c..980045da 100644 --- a/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoViewAttacher.java +++ b/photoview/src/main/java/com/github/chrisbanes/photoview/PhotoViewAttacher.java @@ -88,6 +88,7 @@ public class PhotoViewAttacher implements View.OnTouchListener, private float mBaseRotation; private boolean mZoomEnabled = true; + private boolean mSecondDoubleTapEnabled = true; private ScaleType mScaleType = ScaleType.FIT_CENTER; private OnGestureListener onGestureListener = new OnGestureListener() { @@ -222,7 +223,7 @@ public boolean onDoubleTap(MotionEvent ev) { float y = ev.getY(); if (scale < getMediumScale()) { setScale(getMediumScale(), x, y, true); - } else if (scale >= getMediumScale() && scale < getMaximumScale()) { + } else if (mSecondDoubleTapEnabled && scale >= getMediumScale() && scale < getMaximumScale()) { setScale(getMaximumScale(), x, y, true); } else { setScale(getMinimumScale(), x, y, true); @@ -482,6 +483,11 @@ public void setZoomable(boolean zoomable) { update(); } + public void setSupportSecondDoubleTap(boolean enable) { + mSecondDoubleTapEnabled = enable; + update(); + } + public void update() { if (mZoomEnabled) { // Update the base matrix using the current drawable