@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { if (mPaused) return false; ImageViewTouch imageView = mImageView; if (imageView.getScale() > 1F) { imageView.postTranslateCenter(-distanceX, -distanceY); } return true; }
@Override public boolean onDoubleTap(MotionEvent e) { if (mPaused) return false; ImageViewTouch imageView = mImageView; // Switch between the original scale and 3x scale. if (imageView.getScale() > 2F) { mImageView.zoomTo(1f); } else { mImageView.zoomToPoint(3f, e.getX(), e.getY()); } return true; }
private void updateZoomButtonsEnabled() { ImageViewTouch imageView = mImageView; float scale = imageView.getScale(); mZoomButtonsController.setZoomInEnabled(scale < imageView.mMaxZoom); mZoomButtonsController.setZoomOutEnabled(scale > 1); }