mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-17 09:38:19 +00:00
Have responsive taskbar UI during swipe up gesture.
- Makes taskbar threshold an absolute Y threshold
instead of a distance threshold.
- Moves handle, taskbar view, and taskbar background
during the swipe up gesture
Next CL will address transforming the nav handle <-> taskbar
and ensuring that there's a clean handoff
Bug: 246631059
Test: swipe up on taskbar, release. see bounce
swipe up on taskbar to go home, proper icon alignment
swipe up on taskbar, pause for overview, see bounce
-> further movement should not move taskbar
test launcher3
Change-Id: I141236fd72428cda7edd0ff116de1d478d18c722
This commit is contained in:
@@ -30,6 +30,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.RevealOutlineAnimation;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
@@ -66,6 +67,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
// Initialized in init.
|
||||
private TaskbarControllers mControllers;
|
||||
private int mTaskbarSize;
|
||||
|
||||
// The bounds we want to clip to in the settled state when showing the stashed handle.
|
||||
private final Rect mStashedHandleBounds = new Rect();
|
||||
@@ -96,15 +98,18 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
Resources resources = mActivity.getResources();
|
||||
if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) {
|
||||
mStashedHandleView.getLayoutParams().height =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_size);
|
||||
mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_size);
|
||||
mStashedHandleWidth =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
|
||||
} else {
|
||||
mStashedHandleView.getLayoutParams().height = deviceProfile.taskbarSize;
|
||||
mTaskbarSize = deviceProfile.taskbarSize;
|
||||
mStashedHandleWidth = resources
|
||||
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width);
|
||||
}
|
||||
int taskbarBottomMargin = DisplayController.isTransientTaskbar(mActivity)
|
||||
? resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin)
|
||||
: 0;
|
||||
mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin;
|
||||
|
||||
mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue(
|
||||
isPhoneGestureNavMode(deviceProfile) ? 1 : 0);
|
||||
@@ -181,9 +186,17 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
* morphs into the size of where the taskbar icons will be.
|
||||
*/
|
||||
public Animator createRevealAnimToIsStashed(boolean isStashed) {
|
||||
Rect visualBounds = new Rect(mControllers.taskbarViewController.getIconLayoutBounds());
|
||||
|
||||
if (DisplayController.isTransientTaskbar(mActivity)) {
|
||||
// Account for the full visual height of the transient taskbar.
|
||||
int heightDiff = (mTaskbarSize - visualBounds.height()) / 2;
|
||||
visualBounds.top -= heightDiff;
|
||||
visualBounds.bottom += heightDiff;
|
||||
}
|
||||
|
||||
final RevealOutlineAnimation handleRevealProvider = new RoundedRectRevealOutlineProvider(
|
||||
mStashedHandleRadius, mStashedHandleRadius,
|
||||
mControllers.taskbarViewController.getIconLayoutBounds(), mStashedHandleBounds);
|
||||
mStashedHandleRadius, mStashedHandleRadius, visualBounds, mStashedHandleBounds);
|
||||
|
||||
boolean isReversed = !isStashed;
|
||||
boolean changingDirection = mWasLastRevealAnimReversed != isReversed;
|
||||
@@ -219,6 +232,13 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
mStashedHandleView.setScaleY(mTaskbarStashedHandleHintScale.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the translation of the stashed handle during the swipe up gesture.
|
||||
*/
|
||||
protected void setTranslationYForSwipe(float transY) {
|
||||
mStashedHandleView.setTranslationY(transY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when the home button is disabled, so we can hide this handle as well.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user