use of me.ccrama.redditslide.ForceTouch.util.GestureDetectorCompat 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;
}
});
}
Aggregations