Search in sources :

Example 61 with GestureDetector

use of android.view.GestureDetector in project PhotoPicker by donglua.

the class TouchImageView method sharedConstructing.

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());
}
Also used : Matrix(android.graphics.Matrix) GestureDetector(android.view.GestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Example 62 with GestureDetector

use of android.view.GestureDetector in project ActivityAnimationLib by dkmeteor.

the class FoldingLayout method init.

public void init(Context context, AttributeSet attrs) {
    mScrollGestureDetector = new GestureDetector(context, new ScrollGestureDetector());
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    setAnchorFactor(0);
    super.init(context, attrs);
}
Also used : GestureDetector(android.view.GestureDetector)

Example 63 with GestureDetector

use of android.view.GestureDetector in project TinyDancer by friendlyrobotnyc.

the class TinyCoach method addViewToWindow.

private void addViewToWindow(View view) {
    WindowManager.LayoutParams paramsF = new WindowManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT);
    // configure starting coordinates
    if (fpsConfig.xOrYSpecified) {
        paramsF.x = fpsConfig.startingXPosition;
        paramsF.y = fpsConfig.startingYPosition;
        paramsF.gravity = FPSConfig.DEFAULT_GRAVITY;
    } else if (fpsConfig.gravitySpecified) {
        paramsF.x = 0;
        paramsF.y = 0;
        paramsF.gravity = fpsConfig.startingGravity;
    } else {
        paramsF.gravity = FPSConfig.DEFAULT_GRAVITY;
        paramsF.x = fpsConfig.startingXPosition;
        paramsF.y = fpsConfig.startingYPosition;
    }
    // add view to the window
    windowManager.addView(view, paramsF);
    // create gesture detector to listen for double taps
    GestureDetector gestureDetector = new GestureDetector(view.getContext(), simpleOnGestureListener);
    // attach touch listener
    view.setOnTouchListener(new DancerTouchListener(paramsF, windowManager, gestureDetector));
    // disable haptic feedback
    view.setHapticFeedbackEnabled(false);
    // show the meter
    show();
}
Also used : GestureDetector(android.view.GestureDetector) WindowManager(android.view.WindowManager)

Example 64 with GestureDetector

use of android.view.GestureDetector in project fresco by facebook.

the class ZoomableDraweeView method init.

private void init() {
    mZoomableController = createZoomableController();
    mZoomableController.setListener(mZoomableListener);
    mTapGestureDetector = new GestureDetector(getContext(), mTapListenerWrapper);
}
Also used : GestureDetector(android.view.GestureDetector)

Example 65 with GestureDetector

use of android.view.GestureDetector in project jmonkeyengine by jMonkeyEngine.

the class AndroidInputHandler method addListeners.

protected void addListeners(GLSurfaceView view) {
    view.setOnTouchListener(this);
    view.setOnKeyListener(this);
    AndroidGestureProcessor gestureHandler = new AndroidGestureProcessor(touchInput);
    touchInput.setGestureDetector(new GestureDetector(view.getContext(), gestureHandler));
    touchInput.setScaleDetector(new ScaleGestureDetector(view.getContext(), gestureHandler));
}
Also used : GestureDetector(android.view.GestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Aggregations

GestureDetector (android.view.GestureDetector)133 MotionEvent (android.view.MotionEvent)46 ScaleGestureDetector (android.view.ScaleGestureDetector)23 Paint (android.graphics.Paint)22 View (android.view.View)22 Scroller (android.widget.Scroller)13 WindowManager (android.view.WindowManager)11 Handler (android.os.Handler)9 TextView (android.widget.TextView)9 SimpleOnGestureListener (android.view.GestureDetector.SimpleOnGestureListener)8 LayoutInflater (android.view.LayoutInflater)8 TypedArray (android.content.res.TypedArray)7 ImageView (android.widget.ImageView)7 ViewConfiguration (android.view.ViewConfiguration)6 OverScroller (android.widget.OverScroller)6 Matrix (android.graphics.Matrix)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 FlingAnimationUtils (com.android.systemui.statusbar.FlingAnimationUtils)5 SuppressLint (android.annotation.SuppressLint)4 Resources (android.content.res.Resources)4