Code example for ScaleGestureDetector

Methods: getCurrentSpan, getFocusX, getFocusY, getPreviousSpan, getScaleFactor

0
	public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
 
		@SuppressWarnings("unused") 
		@Override 
		public boolean onScale( ScaleGestureDetector detector ) {
			float span = detector.getCurrentSpan() - detector.getPreviousSpan();
			float targetScale = mCurrentScaleFactor * detector.getScaleFactor();
			if ( mScaleEnabled ) {
				targetScale = Math.min( getMaxZoom(), Math.max( targetScale, MIN_ZOOM ) );
				zoomTo( targetScale, detector.getFocusX(), detector.getFocusY() );
				mCurrentScaleFactor = Math.min( getMaxZoom(), Math.max( targetScale, MIN_ZOOM ) );
				mDoubleTapDirection = 1;
				invalidate(); 
				return true; 
			} 
			return false; 
		} 
	} 
 
    public interface OnImageViewTouchDoubleTapListener { 
        void onDoubleTap();