mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Merge "Polish all apps taskbar unstash behavior for transient and persistent." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8216a26bfe
@@ -887,6 +887,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return mControllers.taskbarStashController.isStashed();
|
||||
}
|
||||
|
||||
/** Returns {@code true} if taskbar All Apps is open. */
|
||||
public boolean isTaskbarAllAppsOpen() {
|
||||
return mControllers.taskbarAllAppsController.isOpen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to start the taskbar translation spring to its settled translation (0).
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,8 @@ public class TaskbarUIController {
|
||||
* Manually closes the overlay window.
|
||||
*/
|
||||
public void hideOverlayWindow() {
|
||||
if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)) {
|
||||
if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)
|
||||
|| mControllers.taskbarAllAppsController.isOpen()) {
|
||||
mControllers.taskbarOverlayController.hideWindow();
|
||||
}
|
||||
}
|
||||
@@ -104,12 +105,19 @@ public class TaskbarUIController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff taskbar is stashed.
|
||||
* Returns {@code true} iff taskbar is stashed.
|
||||
*/
|
||||
public boolean isTaskbarStashed() {
|
||||
return mControllers.taskbarStashController.isStashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} iff taskbar All Apps is open.
|
||||
*/
|
||||
public boolean isTaskbarAllAppsOpen() {
|
||||
return mControllers.taskbarAllAppsController.isOpen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at the end of the swipe gesture on Transient taskbar.
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.List;
|
||||
public final class TaskbarAllAppsController {
|
||||
|
||||
private TaskbarControllers mControllers;
|
||||
private @Nullable TaskbarAllAppsSlideInView mSlideInView;
|
||||
private @Nullable TaskbarAllAppsContainerView mAppsView;
|
||||
|
||||
// Application data models.
|
||||
@@ -107,6 +108,11 @@ public final class TaskbarAllAppsController {
|
||||
show(true);
|
||||
}
|
||||
|
||||
/** Returns {@code true} if All Apps is open. */
|
||||
public boolean isOpen() {
|
||||
return mSlideInView != null && mSlideInView.isOpen();
|
||||
}
|
||||
|
||||
private void show(boolean animate) {
|
||||
if (mAppsView != null) {
|
||||
return;
|
||||
@@ -117,15 +123,15 @@ public final class TaskbarAllAppsController {
|
||||
|
||||
TaskbarOverlayContext overlayContext =
|
||||
mControllers.taskbarOverlayController.requestWindow();
|
||||
TaskbarAllAppsSlideInView slideInView =
|
||||
(TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate(
|
||||
R.layout.taskbar_all_apps, overlayContext.getDragLayer(), false);
|
||||
slideInView.addOnCloseListener(() -> {
|
||||
mSlideInView = (TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate(
|
||||
R.layout.taskbar_all_apps, overlayContext.getDragLayer(), false);
|
||||
mSlideInView.addOnCloseListener(() -> {
|
||||
mControllers.getSharedState().allAppsVisible = false;
|
||||
mSlideInView = null;
|
||||
mAppsView = null;
|
||||
});
|
||||
TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController(
|
||||
overlayContext, slideInView, mControllers);
|
||||
overlayContext, mSlideInView, mControllers);
|
||||
|
||||
viewController.show(animate);
|
||||
mAppsView = overlayContext.getAppsView();
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_AUTO;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
|
||||
@@ -90,20 +88,19 @@ final class TaskbarAllAppsViewController {
|
||||
}
|
||||
|
||||
private void setUpTaskbarStashing() {
|
||||
mTaskbarStashController.updateStateForFlag(
|
||||
DisplayController.isTransientTaskbar(mContext)
|
||||
? FLAG_STASHED_IN_APP_AUTO
|
||||
: FLAG_STASHED_IN_TASKBAR_ALL_APPS,
|
||||
true);
|
||||
mTaskbarStashController.applyState(
|
||||
ALL_APPS.getTransitionDuration(mContext, true /* isToState */));
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true);
|
||||
mTaskbarStashController.applyState(mOverlayController.getOpenDuration());
|
||||
|
||||
mNavbarButtonsViewController.setSlideInViewVisible(true);
|
||||
mSlideInView.setOnCloseBeginListener(() -> {
|
||||
mNavbarButtonsViewController.setSlideInViewVisible(false);
|
||||
AbstractFloatingView.closeOpenContainer(
|
||||
mContext, AbstractFloatingView.TYPE_ACTION_POPUP);
|
||||
if (!DisplayController.isTransientTaskbar(mContext)) {
|
||||
|
||||
if (DisplayController.isTransientTaskbar(mContext)) {
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
|
||||
mTaskbarStashController.applyState(mOverlayController.getCloseDuration());
|
||||
} else {
|
||||
// Post in case view is closing due to gesture navigation. If a gesture is in
|
||||
// progress, wait to unstash until after the gesture is finished.
|
||||
MAIN_EXECUTOR.post(() -> mTaskbarStashController.resetFlagIfNoGestureInProgress(
|
||||
|
||||
@@ -318,7 +318,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
private final int mTaskbarAppWindowThreshold;
|
||||
private final int mTaskbarHomeOverviewThreshold;
|
||||
private final int mTaskbarCatchUpThreshold;
|
||||
private boolean mTaskbarAlreadyOpen;
|
||||
private final boolean mTaskbarAlreadyOpen;
|
||||
private final boolean mIsTaskbarAllAppsOpen;
|
||||
private final boolean mIsTransientTaskbar;
|
||||
// May be set to false when mIsTransientTaskbar is true.
|
||||
private boolean mCanSlowSwipeGoHome = true;
|
||||
@@ -359,6 +360,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
&& DisplayController.isTransientTaskbar(mActivity);
|
||||
TaskbarUIController controller = mActivityInterface.getTaskbarController();
|
||||
mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed();
|
||||
mIsTaskbarAllAppsOpen = controller != null && controller.isTaskbarAllAppsOpen();
|
||||
mTaskbarAppWindowThreshold = res
|
||||
.getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
|
||||
? R.dimen.taskbar_app_window_threshold_v2
|
||||
@@ -2264,7 +2266,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
return displacement;
|
||||
}
|
||||
|
||||
if (mTaskbarAlreadyOpen) {
|
||||
if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) {
|
||||
return displacement;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
|
||||
private final int mTaskbarNavThresholdY;
|
||||
private final int mTaskbarAppWindowThresholdY;
|
||||
private final boolean mTaskbarAlreadyOpen;
|
||||
private final boolean mIsTaskbarAllAppsOpen;
|
||||
private boolean mHasPassedTaskbarNavThreshold;
|
||||
private boolean mHasPassedTaskbarAppWindowThreshold;
|
||||
|
||||
@@ -88,6 +89,8 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
|
||||
mTaskbarAppWindowThresholdY = screenHeight - taskbarAppWindowThreshold;
|
||||
mTaskbarAlreadyOpen = mTaskbarActivityContext != null
|
||||
&& !mTaskbarActivityContext.isTaskbarStashed();
|
||||
mIsTaskbarAllAppsOpen =
|
||||
mTaskbarActivityContext != null && mTaskbarActivityContext.isTaskbarAllAppsOpen();
|
||||
|
||||
mIsTransientTaskbar = DisplayController.isTransientTaskbar(context);
|
||||
|
||||
@@ -184,7 +187,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
|
||||
|
||||
if (dY < 0) {
|
||||
dY = -OverScroll.dampedScroll(-dY, mTaskbarNavThresholdY);
|
||||
if (mTransitionCallback != null) {
|
||||
if (mTransitionCallback != null && !mIsTaskbarAllAppsOpen) {
|
||||
mTransitionCallback.onActionMove(dY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user