Java 类android.view.ScaleGestureDetector 实例源码

项目:MinimalismJotter    文件:ZoomableImageView.java   
@Override
public boolean onScale( ScaleGestureDetector detector )
{   
    // Check if the detector is in progress in order to proceed
    if(detector!=null && detector.isInProgress() ){
        try{
            // Grab the scale
            float targetScale = getScale() * detector.getScaleFactor();
            // Correct for the min scale
            targetScale = Math.min( maxZoom(), Math.max( targetScale, 1.0f) );

            // Zoom and invalidate the view
            zoomTo( targetScale, detector.getFocusX(), detector.getFocusY() );
            invalidate();

            return true;
        }catch(IllegalArgumentException e){
            e.printStackTrace();
        }
    }
    return false;
}
项目:social-app-android    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
        DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
        compatPostOnAnimation(doubleTap);
    }
}
项目:Monolith    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:CXJPadProject    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:LongImageCamera    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 6;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:event-me    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
        DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
        compatPostOnAnimation(doubleTap);
    }
}
项目:memetastic    文件:TouchImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    float mScaleFactor = detector.getScaleFactor();
    float origScale = saveScale;
    saveScale *= mScaleFactor;
    if (saveScale > maxScale) {
        saveScale = maxScale;
        mScaleFactor = maxScale / origScale;
    } else if (saveScale < minScale) {
        saveScale = minScale;
        mScaleFactor = minScale / origScale;
    }

    if (origWidth * saveScale <= viewWidth
            || origHeight * saveScale <= viewHeight)
        matrix.postScale(mScaleFactor, mScaleFactor, viewWidth / 2,
                viewHeight / 2);
    else
        matrix.postScale(mScaleFactor, mScaleFactor,
                detector.getFocusX(), detector.getFocusY());

    fixTrans();
    return true;
}
项目:chat-sdk-android-push-firebase    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
    DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
    compatPostOnAnimation(doubleTap);
    }
}
项目:boohee_v5.6    文件:TouchImageView.java   
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    TouchImageView.this.setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = TouchImageView.this.normalizedScale;
    if (TouchImageView.this.normalizedScale > TouchImageView.this.maxScale) {
        targetZoom = TouchImageView.this.maxScale;
        animateToZoomBoundary = true;
    } else if (TouchImageView.this.normalizedScale < TouchImageView.this.minScale) {
        targetZoom = TouchImageView.this.minScale;
        animateToZoomBoundary = true;
    }
    if (animateToZoomBoundary) {
        TouchImageView.this.compatPostOnAnimation(new DoubleTapZoom(targetZoom, (float)
                (TouchImageView.this.viewWidth / 2), (float) (TouchImageView.this
                .viewHeight / 2), true));
    }
}
项目:BlogBookApp    文件:ZoomImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:AndroidBackendlessChat    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:AndroidBackendlessChat    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
    DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
    compatPostOnAnimation(doubleTap);
    }
}
项目:LueansRead    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:Monolith    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
        DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
        compatPostOnAnimation(doubleTap);
    }
}
项目:OSchina_resources_android    文件:ZoomImageView.java   
public ZoomImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    setScaleType(ScaleType.MATRIX);
    mGestureDetector = new GestureDetector(context,
            new SimpleOnGestureListener() {
                @Override
                public boolean onDoubleTap(MotionEvent e) {
                    if (isAutoScale)
                        return true;
                    float x = e.getX();
                    float y = e.getY();
                    if (getScale() < SCALE_MID) {
                        postDelayed(new ScaleRunnable(SCALE_MID, x, y), 16);
                        isAutoScale = true;
                    } else {
                        postDelayed(new ScaleRunnable(mScale, x, y), 16);
                        isAutoScale = true;
                    }
                    return true;
                }
            });
    mScaleGestureDetector = new ScaleGestureDetector(context, this);
    this.setOnTouchListener(this);
}
项目:LongImageCamera    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
    DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
    compatPostOnAnimation(doubleTap);
    }
}
项目:AndroidBasicLibs    文件:LargeImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    if (!isEnabled()) {
        return false;
    }
    if (!hasLoad()) {
        return false;
    }
    float newScale;
    newScale = mScale * detector.getScaleFactor();
    if (newScale > maxScale) {
        newScale = maxScale;
    } else if (newScale < minScale) {
        newScale = minScale;
    }
    setScale(newScale, (int) detector.getFocusX(), (int) detector.getFocusY());
    return true;
}
项目:Blockly    文件:VirtualWorkspaceView.java   
@Override
public void onFinishInflate() {
    super.onFinishInflate();

    mWorkspaceView = (WorkspaceView) findViewById(R.id.workspace);
    // Setting the child view's pivot point to (0,0) means scaling leaves top-left corner in
    // place means there is no need to adjust view translation.
    mWorkspaceView.setPivotX(0);
    mWorkspaceView.setPivotY(0);

    setWillNotDraw(false);
    setHorizontalScrollBarEnabled(mScrollable);
    setVerticalScrollBarEnabled(mScrollable);

    mScaleGestureDetector = new ScaleGestureDetector(getContext(), new ScaleGestureListener());
    mTapGestureDetector = new GestureDetector(getContext(), new TapGestureListener());
    mGridRenderer.updateGridBitmap(mViewScale);
    mImeManager = (InputMethodManager) getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
}
项目:JsoupSample    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:JsoupSample    文件:TouchImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
        DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
        compatPostOnAnimation(doubleTap);
    }
}
项目:chat-sdk-android-push-firebase    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:social-app-android    文件:TouchImageView.java   
private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
项目:BlogBookApp    文件:ZoomImageView.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);
    setState(State.NONE);
    boolean animateToZoomBoundary = false;
    float targetZoom = normalizedScale;
    if (normalizedScale > maxScale) {
        targetZoom = maxScale;
        animateToZoomBoundary = true;

    } else if (normalizedScale < minScale) {
        targetZoom = minScale;
        animateToZoomBoundary = true;
    }

    if (animateToZoomBoundary) {
        DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
        compatPostOnAnimation(doubleTap);
    }
}
项目:target-layout    文件:TargetLayout.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    if (!levelChanged) {
        animateLevelTransition();
        scaleFactor = getScaleFactor(target.getCurrentLevel().getSizePercent());
    }
}
项目:ZoomLayout    文件:ZoomEngine.java   
/**
 * Constructs an helper instance.
 *
 * @param context a valid context
 * @param container the view hosting the zoomable content
 * @param listener a listener for events
 */
public ZoomEngine(Context context, View container, Listener listener) {
    mView = container;
    mListener = listener;

    mFlingScroller = new OverScroller(context);
    mScaleDetector = new ScaleGestureDetector(context, new PinchListener());
    if (Build.VERSION.SDK_INT >= 19) mScaleDetector.setQuickScaleEnabled(false);
    mFlingDragDetector = new GestureDetector(context, new FlingScrollListener());
    container.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
项目:Customerly-Android-SDK    文件:TouchImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);

    //
    // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
    //
    if (touchImageViewListener != null) {
        touchImageViewListener.onMove();
    }
    return true;
}
项目:GitHub    文件:ChartTouchHandler.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    if (isZoomEnabled) {
        float scale = 2.0f - detector.getScaleFactor();
        if (Float.isInfinite(scale)) {
            scale = 1;
        }
        return chartZoomer.scale(computator, detector.getFocusX(), detector.getFocusY(), scale);
    }

    return false;
}
项目:GitHub    文件:PieChartTouchHandler.java   
public PieChartTouchHandler(Context context, PieChartView chart) {
    super(context, chart);
    pieChart = (PieChartView) chart;
    scroller = ScrollerCompat.create(context);
    gestureDetector = new GestureDetector(context, new ChartGestureListener());
    scaleGestureDetector = new ScaleGestureDetector(context, new ChartScaleGestureListener());
    isZoomEnabled = false;// Zoom is not supported by PieChart.
}
项目:GraffitiDemo    文件:GraffitiView.java   
public GraffitiView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mCurrentStatus = STATUS_INIT;
    //关闭硬件加速
    if (Build.VERSION.SDK_INT >= 11) {
        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }
    mContext = context;
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleListener());
}
项目:Linphone4Android    文件:CompatibilityScaleGestureDetector.java   
@Override
  public boolean onScale(ScaleGestureDetector detector) {
if (listener == null) {
    return false;
}

return listener.onScale(this);
  }
项目:exciting-app    文件:ImageViewTouch.java   
@Override
protected void init(Context context, AttributeSet attrs, int defStyle) {
    super.init(context, attrs, defStyle);
    mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    mGestureListener = getGestureListener();
    mScaleListener = getScaleListener();

    mScaleDetector = new ScaleGestureDetector(getContext(), mScaleListener);
    mGestureDetector = new GestureDetector(getContext(), mGestureListener, null, true);

    mDoubleTapDirection = 1;


}
项目:LaunchEnr    文件:PinchToOverviewListener.java   
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
    if (mLauncher.mState != Launcher.State.WORKSPACE || mLauncher.isOnCustomContent()) {
        // Don't listen for the pinch gesture if on all apps, widget picker, -1, etc.
        return false;
    }
    if (mAnimationManager != null && mAnimationManager.isAnimating()) {
        // Don't listen for the pinch gesture if we are already animating from a previous one.
        return false;
    }
    if (mLauncher.isWorkspaceLocked()) {
        // Don't listen for the pinch gesture if the workspace isn't ready.
        return false;
    }
    if (mWorkspace == null) {
        mWorkspace = mLauncher.getWorkspace();
        mThresholdManager = new PinchThresholdManager(mWorkspace);
        mAnimationManager = new PinchAnimationManager(mLauncher);
    }
    if (mWorkspace.isSwitchingState() || mWorkspace.mScrollInteractionBegan) {
        // Don't listen for the pinch gesture while switching state, as it will cause a jump
        // once the state switching animation is complete.
        return false;
    }
    if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
        // Don't listen for the pinch gesture if a floating view is open.
        return false;
    }

    mPreviousProgress = mWorkspace.isInOverviewMode() ? OVERVIEW_PROGRESS : WORKSPACE_PROGRESS;
    mPreviousTimeMillis = System.currentTimeMillis();
    mInterpolator = mWorkspace.isInOverviewMode() ? new LogDecelerateInterpolator(100, 0)
            : new LogAccelerateInterpolator(100, 0);
    mPinchStarted = true;
    mWorkspace.onPrepareStateTransition(true);
    return true;
}
项目:Monolith    文件:TouchImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);

    //
    // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
    //
    if (touchImageViewListener != null) {
        touchImageViewListener.onMove();
    }
    return true;
}
项目:SimpleUILauncher    文件:PinchToOverviewListener.java   
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    super.onScaleEnd(detector);

    float progressVelocity = mProgressDelta / mTimeDelta;
    float passedThreshold = mThresholdManager.getPassedThreshold();
    boolean isFling = mWorkspace.isInOverviewMode() && progressVelocity >= FLING_VELOCITY
            || !mWorkspace.isInOverviewMode() && progressVelocity <= -FLING_VELOCITY;
    boolean shouldCancelPinch = !isFling && passedThreshold < PinchThresholdManager.THRESHOLD_ONE;
    // If we are going towards overview, mPreviousProgress is how much further we need to
    // go, since it is going from 1 to 0. If we are going to workspace, we want
    // 1 - mPreviousProgress.
    float remainingProgress = mPreviousProgress;
    if (mWorkspace.isInOverviewMode() || shouldCancelPinch) {
        remainingProgress = 1f - mPreviousProgress;
    }
    int duration = computeDuration(remainingProgress, progressVelocity);
    if (shouldCancelPinch) {
        cancelPinch(mPreviousProgress, duration);
    } else if (passedThreshold < PinchThresholdManager.THRESHOLD_THREE) {
        float toProgress = mWorkspace.isInOverviewMode() ?
                WORKSPACE_PROGRESS : OVERVIEW_PROGRESS;
        mAnimationManager.animateToProgress(mPreviousProgress, toProgress, duration,
                mThresholdManager);
    } else {
        mThresholdManager.reset();
        mWorkspace.onLauncherTransitionEnd(mLauncher, false, true);
    }
    mPinchStarted = false;
    mPinchCanceled = false;
}
项目:Android-Demo_ImageCroper    文件:CropOverlayView.java   
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public boolean onScale(ScaleGestureDetector detector) {
    RectF rect = mCropWindowHandler.getRect();

    float x = detector.getFocusX();
    float y = detector.getFocusY();
    float dY = detector.getCurrentSpanY() / 2;
    float dX = detector.getCurrentSpanX() / 2;

    float newTop = y - dY;
    float newLeft = x - dX;
    float newRight = x + dX;
    float newBottom = y + dY;

    if (newLeft < newRight &&
            newTop <= newBottom &&
            newLeft >= 0 &&
            newRight <= mCropWindowHandler.getMaxCropWidth() &&
            newTop >= 0 &&
            newBottom <= mCropWindowHandler.getMaxCropHeight()) {

        rect.set(newLeft, newTop, newRight, newBottom);
        mCropWindowHandler.setRect(rect);
        invalidate();
    }

    return true;
}
项目:android-titanium-imagecropper    文件:CropOverlayView.java   
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public boolean onScale(ScaleGestureDetector detector) {
  RectF rect = mCropWindowHandler.getRect();

  float x = detector.getFocusX();
  float y = detector.getFocusY();
  float dY = detector.getCurrentSpanY() / 2;
  float dX = detector.getCurrentSpanX() / 2;

  float newTop = y - dY;
  float newLeft = x - dX;
  float newRight = x + dX;
  float newBottom = y + dY;

  if (newLeft < newRight
      && newTop <= newBottom
      && newLeft >= 0
      && newRight <= mCropWindowHandler.getMaxCropWidth()
      && newTop >= 0
      && newBottom <= mCropWindowHandler.getMaxCropHeight()) {

    rect.set(newLeft, newTop, newRight, newBottom);
    mCropWindowHandler.setRect(rect);
    invalidate();
  }

  return true;
}
项目:chat-sdk-android-push-firebase    文件:TouchImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);

    //
    // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
    //
    if (touchImageViewListener != null) {
        touchImageViewListener.onMove();
    }
    return true;
}
项目:Android_ImagePicker    文件:TouchImageView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);

    //
    // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
    //
    if (touchImageViewListener != null) {
        touchImageViewListener.onMove();
    }
    return true;
}
项目:microMathematics    文件:TwoDScrollView.java   
public void onScaleEnd(ScaleGestureDetector detector)
{
    if (isScaled)
    {
        scale *= detector.getScaleFactor();
        if (listChangeIf != null)
        {
            listChangeIf.onScale(scale);
            getMainLayout().setScaleX(1.0f);
            getMainLayout().setScaleY(1.0f);
        }
    }
    isScaled = false;
}
项目:FlickLauncher    文件:CropView.java   
@Override
public boolean onScale(ScaleGestureDetector detector) {
    // Don't need the lock because this will only fire inside of
    // onTouchEvent
    mRenderer.scale *= detector.getScaleFactor();
    mRenderer.scale = Math.max(mMinScale, mRenderer.scale);
    invalidate();
    return true;
}