Example usage for android.support.v4.view GestureDetectorCompat GestureDetectorCompat

List of usage examples for android.support.v4.view GestureDetectorCompat GestureDetectorCompat

Introduction

In this page you can find the example usage for android.support.v4.view GestureDetectorCompat GestureDetectorCompat.

Prototype

public GestureDetectorCompat(Context context, OnGestureListener onGestureListener, Handler handler) 

Source Link

Usage

From source file:com.hippo.largeimageview.GestureRecognizer.java

public GestureRecognizer(Context context, Listener listener) {
    mListener = listener;/*w ww.  j  a v a 2 s. c  o  m*/
    final Handler handler = new Handler(Looper.getMainLooper());
    mGestureDetector = new GestureDetectorCompat(context, this, handler);
    mGestureDetector.setOnDoubleTapListener(this);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mScaleDetector = new ScaleGestureDetector(context, this, handler);
    } else {
        mScaleDetector = new ScaleGestureDetector(context, this);
    }
}

From source file:com.hippo.ehviewer.gallery.gl.GestureRecognizer.java

public GestureRecognizer(Context context, Listener listener) {
    mListener = listener;//from  w  ww  .jav a 2  s  . c om
    MyGestureListener gestureListener = new MyGestureListener();
    mGestureDetector = new GestureDetectorCompat(context, gestureListener, null /* ignoreMultitouch */);
    mGestureDetector.setOnDoubleTapListener(gestureListener);
    mScaleDetector = new ScaleGestureDetector(context, new MyScaleListener());
    mDownUpDetector = new DownUpDetector(new MyDownUpListener());
}

From source file:com.android.volley.ui.PhotoView.java

/**
 * Initializes the header and any static values
 */// w  ww .j a v  a  2  s.co m
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);
}

From source file:cl.monsoon.s1next.widget.PhotoView.java

/**
 * Initializes the header and any static values
 *//*  ww  w. jav  a  2 s.co  m*/
private void initialize() {
    Context context = getContext();

    if (!sInitialized) {
        sInitialized = true;

        Resources resources = context.getResources();

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

        sCropDimPaint = new Paint();
        sCropDimPaint.setAntiAlias(true);
        sCropDimPaint.setColor(ContextCompat.getColor(context, R.color.photo_view_crop_dim_color));
        sCropDimPaint.setStyle(Style.FILL);

        sCropPaint = new Paint();
        sCropPaint.setAntiAlias(true);
        sCropPaint.setColor(ContextCompat.getColor(context, R.color.photo_view_crop_dim_color));
        sCropPaint.setStyle(Style.STROKE);
        sCropPaint.setStrokeWidth(resources.getDimension(R.dimen.photo_view_crop_stroke_width));

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

    mGestureDetector = new GestureDetectorCompat(context, this, null);
    scaleGestureDetector = new ScaleGestureDetector(context, this);
    mQuickScaleEnabled = ScaleGestureDetectorCompat.isQuickScaleEnabled(scaleGestureDetector);
    mScaleRunnable = new ScaleRunnable(this);
    mTranslateRunnable = new TranslateRunnable(this);
    mSnapRunnable = new SnapRunnable(this);
    mRotateRunnable = new RotateRunnable(this);
}

From source file:martin.app.bitunion.widget.PhotoView.java

/**
 * Initializes the header and any static values
 *///from w w  w.  j  ava2s  . co  m
private void initialize() {
    Context context = getContext();

    if (!sInitialized) {
        sInitialized = true;

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

        //            sCropSize = TypedValue.complexToDimensionPixelSize(120, resources.getDisplayMetrics());

        sCropDimPaint = new Paint();
        sCropDimPaint.setAntiAlias(true);
        //            sCropDimPaint.setColor(0xcc000000);
        sCropDimPaint.setStyle(Paint.Style.FILL);

        sCropPaint = new Paint();
        sCropPaint.setAntiAlias(true);
        //            sCropPaint.setColor(Color.WHITE);
        sCropPaint.setStyle(Paint.Style.STROKE);
        //            sCropPaint.setStrokeWidth(TypedValue.complexToDimensionPixelSize(1, resources.getDisplayMetrics()));

        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);
}