android.support.v4.view.ScaleGestureDetectorCompat Java Examples

The following examples show how to use android.support.v4.view.ScaleGestureDetectorCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FoldLayout.java    From ListItemFold with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    this.velocityTracker = VelocityTracker.obtain();
    this.interpolatorFling = new FoldInterpolator();
    this.interpolatorTap = new AccelerateDecelerateInterpolator();
    this.pinchDetector = new ScaleGestureDetector(getContext(), this);
    ScaleGestureDetectorCompat.setQuickScaleEnabled(pinchDetector, false);
    this.viewConfig = ViewConfiguration.get(getContext());
}
 
Example #2
Source File: PhotoView.java    From v2ex-daily-android with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the header and any static values
 */
private void initialize() {
    Context context = getContext();

    if (!sInitialized) {
        sInitialized = true;

        Resources resources = context.getApplicationContext().getResources();

        sCropSize = resources.getDimensionPixelSize(R.dimen.photo_crop_width);

        sCropDimPaint = new Paint();
        sCropDimPaint.setAntiAlias(true);
        sCropDimPaint.setColor(resources.getColor(R.color.photo_crop_dim_color));
        sCropDimPaint.setStyle(Style.FILL);

        sCropPaint = new Paint();
        sCropPaint.setAntiAlias(true);
        sCropPaint.setColor(resources.getColor(R.color.photo_crop_highlight_color));
        sCropPaint.setStyle(Style.STROKE);
        sCropPaint.setStrokeWidth(resources.getDimension(R.dimen.photo_crop_stroke_width));

        final ViewConfiguration configuration = ViewConfiguration.get(context);
        final int touchSlop = configuration.getScaledTouchSlop();
        sTouchSlopSquare = touchSlop * touchSlop;
    }

    mGestureDetector = new GestureDetectorCompat(context, this, null);
    mScaleGetureDetector = new ScaleGestureDetector(context, this);
    mQuickScaleEnabled = ScaleGestureDetectorCompat.isQuickScaleEnabled(mScaleGetureDetector);
    mScaleRunnable = new ScaleRunnable(this);
    mTranslateRunnable = new TranslateRunnable(this);
    mSnapRunnable = new SnapRunnable(this);
    mRotateRunnable = new RotateRunnable(this);
}
 
Example #3
Source File: XYScrollView.java    From xpra-client with GNU General Public License v3.0 4 votes vote down vote up
private void init() {
	ScaleGestureDetectorCompat.setQuickScaleEnabled(scaleGestureDetector, true);
	final ViewConfiguration configuration = ViewConfiguration.get(getContext());
	mTouchSlop = configuration.getScaledTouchSlop();
}
 
Example #4
Source File: TouchGestureDetector.java    From ByakuGallery with Apache License 2.0 4 votes vote down vote up
public TouchGestureDetector(Context context, OnTouchGestureListener listener) {
	mGestureDetector = new GestureDetectorCompat(context, listener);
	mGestureDetector.setOnDoubleTapListener(listener);
	mScaleGestureDetector = new ScaleGestureDetector(context, listener);
	ScaleGestureDetectorCompat.setQuickScaleEnabled(mScaleGestureDetector, false);
}