コード例 #1
1
 @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;
 }
コード例 #2
0
    @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;
    }
コード例 #3
0
 private void updateZoomButtonsEnabled() {
   ImageViewTouch imageView = mImageView;
   float scale = imageView.getScale();
   mZoomButtonsController.setZoomInEnabled(scale < imageView.mMaxZoom);
   mZoomButtonsController.setZoomOutEnabled(scale > 1);
 }