Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down