Search in sources :

Example 1 with GestureListener

use of me.ccrama.redditslide.ForceTouch.util.GestureListener in project Slide by ccrama.

the class Peek method applyTo.

/**
 * Finish the builder by selecting the base view that you want to show the PeekView from.
 *
 * @param activity the PeekViewActivity that you are on.
 * @param base the view that you want to touch to apply the peek to.
 */
public void applyTo(final PeekViewActivity activity, final View base) {
    final GestureDetectorCompat detector = new GestureDetectorCompat(activity, new GestureListener(activity, base, this));
    base.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, final MotionEvent motionEvent) {
            // we use the detector for the long and short click motion events
            detector.onTouchEvent(motionEvent);
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                forceRippleAnimation(base, motionEvent);
            }
            return true;
        }
    });
}
Also used : GestureListener(me.ccrama.redditslide.ForceTouch.util.GestureListener) GestureDetectorCompat(me.ccrama.redditslide.ForceTouch.util.GestureDetectorCompat) PeekView(me.ccrama.redditslide.ForceTouch.PeekView) View(android.view.View) MotionEvent(android.view.MotionEvent)

Aggregations

MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 PeekView (me.ccrama.redditslide.ForceTouch.PeekView)1 GestureDetectorCompat (me.ccrama.redditslide.ForceTouch.util.GestureDetectorCompat)1 GestureListener (me.ccrama.redditslide.ForceTouch.util.GestureListener)1