Skip to content
Snippets Groups Projects
Commit 38878c32 authored by Nick's avatar Nick :v: Committed by Dhina17
Browse files

wm: QC-like gesture fling boost

Idea by minaripenguin37 <alexfinhart@gmail.com> and hydrangea07 <104114625+hydrangea07@users.noreply.github.com>

Change-Id: I53b27395a9ab1e067f65011c0aabd9f3b186d324
parent 2c1b28eb
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
int screenWidth;
private int mDownPointers;
private boolean mSwipeFireable;
private boolean mScrollFireable;
private boolean mDebugFireable;
private boolean mMouseHoveringAtLeft;
private boolean mMouseHoveringAtTop;
......@@ -183,6 +184,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
case MotionEvent.ACTION_DOWN:
mSwipeFireable = true;
mDebugFireable = true;
mScrollFireable = true;
mDownPointers = 0;
captureDown(event, 0);
if (mMouseHoveringAtLeft) {
......@@ -289,6 +291,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
case MotionEvent.ACTION_CANCEL:
mSwipeFireable = false;
mDebugFireable = false;
mScrollFireable = false;
mCallbacks.onUpOrCancel();
break;
default:
......@@ -430,6 +433,21 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
}
return true;
}
@Override
public boolean onScroll(MotionEvent down, MotionEvent up,
float velocityX, float velocityY) {
int duration = mOverscroller.getDuration();
if (duration > MAX_FLING_TIME_MILLIS) {
duration = MAX_FLING_TIME_MILLIS;
}
if (mScrollFireable) {
mCallbacks.onFling(duration + 160);
mScrollFireable = false;
}
return true;
}
@Override
public boolean onFling(MotionEvent down, MotionEvent up,
float velocityX, float velocityY) {
......@@ -446,7 +464,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
duration = MAX_FLING_TIME_MILLIS;
}
mLastFlingTime = now;
mCallbacks.onFling(duration);
mCallbacks.onFling(duration + 160);
return true;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment