mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
[Trackpad] Do not reverse two-finger gestures on the homescreen when reverse scrolling is on
- Swipe up to pull up all apps - Swipe down to pull down notifications - Same gesture to close in reverse scrolling mode Bug: 301966246 Bug: 301966690 Test: manual Change-Id: Ia3770ce8b279d24b2de4844f441f14e0feaf57c7
This commit is contained in:
@@ -22,6 +22,7 @@ import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.MotionEventsUtils.isTrackpadScroll;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
@@ -68,6 +69,7 @@ public abstract class AbstractStateChangeTouchController
|
||||
protected boolean mGoingBetweenStates = true;
|
||||
// Ratio of transition process [0, 1] to drag displacement (px)
|
||||
protected float mProgressMultiplier;
|
||||
protected boolean mIsTrackpadReverseScroll;
|
||||
|
||||
private boolean mNoIntercept;
|
||||
private boolean mIsLogContainerSet;
|
||||
@@ -92,6 +94,9 @@ public abstract class AbstractStateChangeTouchController
|
||||
return false;
|
||||
}
|
||||
|
||||
mIsTrackpadReverseScroll = !mLauncher.isNaturalScrollingEnabled()
|
||||
&& isTrackpadScroll(ev);
|
||||
|
||||
// Now figure out which direction scroll events the controller will start
|
||||
// calling the callbacks.
|
||||
final int directionsToDetectScroll;
|
||||
@@ -248,6 +253,11 @@ public abstract class AbstractStateChangeTouchController
|
||||
}
|
||||
mIsLogContainerSet = true;
|
||||
}
|
||||
// Only reverse the gesture to open all apps (not close) when trackpad reverse scrolling is
|
||||
// on.
|
||||
if (mIsTrackpadReverseScroll && mStartState == NORMAL) {
|
||||
displacement = -displacement;
|
||||
}
|
||||
return onDrag(displacement);
|
||||
}
|
||||
|
||||
@@ -274,6 +284,11 @@ public abstract class AbstractStateChangeTouchController
|
||||
return;
|
||||
}
|
||||
|
||||
// Only reverse the gesture to open all apps (not close) when trackpad reverse scrolling is
|
||||
// on.
|
||||
if (mIsTrackpadReverseScroll && mStartState == NORMAL) {
|
||||
velocity = -velocity;
|
||||
}
|
||||
boolean fling = mDetector.isFling(velocity);
|
||||
|
||||
boolean blockedFling = fling && mFlingBlockCheck.isBlocked();
|
||||
@@ -412,9 +427,15 @@ public abstract class AbstractStateChangeTouchController
|
||||
mGoingBetweenStates = true;
|
||||
mDetector.finishedScrolling();
|
||||
mDetector.setDetectableScrollConditions(0, false);
|
||||
mIsTrackpadReverseScroll = false;
|
||||
}
|
||||
|
||||
private void cancelAnimationControllers() {
|
||||
mCurrentAnimation = null;
|
||||
}
|
||||
|
||||
protected boolean shouldOpenAllApps(boolean isDragTowardPositive) {
|
||||
return (isDragTowardPositive && !mIsTrackpadReverseScroll)
|
||||
|| (!isDragTowardPositive && mIsTrackpadReverseScroll);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user