Code example for ScaleGestureDetector

Methods: getFocusXgetFocusYgetScaleFactor

0
                        if (mode == DRAG) {
                            float deltaX = curr.x - last.x;
                            float deltaY = curr.y - last.y;
                            float fixTransX = getFixDragTrans(deltaX, viewWidth, origWidth * saveScale);
                            float fixTransY = getFixDragTrans(deltaY, viewHeight, origHeight * saveScale);
                            matrix.postTranslate(fixTransX, fixTransY);
                            fixTrans(); 
                            last.set(curr.x, curr.y);
                        } 
                        if (xDiff > LONG_CLICK || yDiff > LONG_CLICK) {
                            clearCheckForLongClick(); 
                        } 
                        break; 
 
                    case MotionEvent.ACTION_UP:
                        mode = NONE;
                        if (xDiff < CLICK && yDiff < CLICK)
                            performClick();
                        clearCheckForLongClick(); 
                        break; 
 
                    case MotionEvent.ACTION_POINTER_UP:
                        mode = NONE;
                        break; 
                } 
                 
                setImageMatrix(matrix);
                invalidate();
                return true; // indicate event was handled 
            } 
 
        }); 
    } 
 
    public void setMaxZoom(float x) {
        maxScale = x;
    } 
 
    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        @Override 
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            mode = ZOOM;
            return true; 
        } 
Contextual code suggestions in your IDE  Get Codota for Java