mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Merge "Override displacement for transient taskbar instead of mCurrentShift" into tm-qpr-dev am: da858aab44
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20535957 Change-Id: Ida928802918f736d178ad16926256982c02c479c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -825,7 +825,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
return;
|
||||
}
|
||||
mLauncherTransitionController.setProgress(
|
||||
Math.max(getTaskbarProgress(), getScaleProgressDueToScroll()), mDragLengthFactor);
|
||||
Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2187,7 +2187,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
AnimatorControllerWithResistance playbackController =
|
||||
remoteHandle.getPlaybackController();
|
||||
if (playbackController != null) {
|
||||
playbackController.setProgress(Math.max(getTaskbarProgress(),
|
||||
playbackController.setProgress(Math.max(mCurrentShift.value,
|
||||
getScaleProgressDueToScroll()), mDragLengthFactor);
|
||||
}
|
||||
|
||||
@@ -2239,31 +2239,32 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the current shift progress to keep the app window at the bottom of the screen
|
||||
* while the transient taskbar is being swiped in.
|
||||
* Overrides the gesture displacement to keep the app window at the bottom of the screen while
|
||||
* the transient taskbar is being swiped in.
|
||||
*
|
||||
* There is also a catch up period so that the window can start moving 1:1 with the swipe.
|
||||
*/
|
||||
private float getTaskbarProgress() {
|
||||
@Override
|
||||
protected float overrideDisplacementForTransientTaskbar(float displacement) {
|
||||
if (!mIsTransientTaskbar) {
|
||||
return mCurrentShift.value;
|
||||
return displacement;
|
||||
}
|
||||
|
||||
if (mTaskbarAlreadyOpen) {
|
||||
return mCurrentShift.value;
|
||||
return displacement;
|
||||
}
|
||||
|
||||
if (mCurrentDisplacement < mTaskbarAppWindowThreshold) {
|
||||
if (displacement < mTaskbarAppWindowThreshold) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// "Catch up" with `mCurrentShift.value`.
|
||||
if (mCurrentDisplacement < mTaskbarCatchUpThreshold) {
|
||||
return Utilities.mapToRange(mCurrentDisplacement, mTaskbarAppWindowThreshold,
|
||||
mTaskbarCatchUpThreshold, 0, mCurrentShift.value, ACCEL_DEACCEL);
|
||||
// "Catch up" with the displacement at mTaskbarCatchUpThreshold.
|
||||
if (displacement < mTaskbarCatchUpThreshold) {
|
||||
return Utilities.mapToRange(displacement, mTaskbarAppWindowThreshold,
|
||||
mTaskbarCatchUpThreshold, 0, mTaskbarCatchUpThreshold, ACCEL_DEACCEL);
|
||||
}
|
||||
|
||||
return mCurrentShift.value;
|
||||
return displacement;
|
||||
}
|
||||
|
||||
private void setDividerShown(boolean shown, boolean immediate) {
|
||||
|
||||
@@ -116,7 +116,7 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
@UiThread
|
||||
public void updateDisplacement(float displacement) {
|
||||
// We are moving in the negative x/y direction
|
||||
displacement = -displacement;
|
||||
displacement = overrideDisplacementForTransientTaskbar(-displacement);
|
||||
mCurrentDisplacement = displacement;
|
||||
|
||||
float shift;
|
||||
@@ -130,6 +130,17 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
mCurrentShift.updateValue(shift);
|
||||
}
|
||||
|
||||
/**
|
||||
* When Transient Taskbar is enabled, subclasses can override the displacement to keep the app
|
||||
* window at the bottom of the screen while taskbar is being swiped in.
|
||||
* @param displacement The distance the user has swiped up from the bottom of the screen. This
|
||||
* value will be positive unless the user swipe downwards.
|
||||
* @return the overridden displacement.
|
||||
*/
|
||||
protected float overrideDisplacementForTransientTaskbar(float displacement) {
|
||||
return displacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the value of {@link #mCurrentShift} changes
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user