Hide back button in drag-n-drop and quick scrub
Add a state flag to hide the back button, used by NORMAL, SPRING_LOADED,
and FAST_OVERVIEW states.
Bug: 74390697
Change-Id: Ifdb2aa41691db4594ea597fc5b5839967711b43d
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 9fef64a..d5a2120 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -60,6 +60,7 @@
protected static final int FLAG_ALL_APPS_SCRIM = 1 << 7;
protected static final int FLAG_DISABLE_INTERACTION = 1 << 8;
protected static final int FLAG_OVERVIEW_UI = 1 << 9;
+ protected static final int FLAG_HIDE_BACK_BUTTON = 1 << 10;
protected static final PageAlphaProvider DEFAULT_ALPHA_PROVIDER =
new PageAlphaProvider(ACCEL_2) {
@@ -75,7 +76,7 @@
* TODO: Create a separate class for NORMAL state.
*/
public static final LauncherState NORMAL = new LauncherState(0, ContainerType.WORKSPACE,
- 0, FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED);
+ 0, FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON);
/**
* Various Launcher states arranged in the increasing order of UI layers
@@ -140,6 +141,12 @@
*/
public final boolean overviewUi;
+ /**
+ * True if the back button should be hidden when in this state (assuming no floating views are
+ * open, launcher has window focus, etc).
+ */
+ public final boolean hideBackButton;
+
public LauncherState(int id, int containerType, int transitionDuration, int flags) {
this.containerType = containerType;
this.transitionDuration = transitionDuration;
@@ -157,6 +164,7 @@
this.disablePageClipping = (flags & FLAG_DISABLE_PAGE_CLIPPING) != 0;
this.disableInteraction = (flags & FLAG_DISABLE_INTERACTION) != 0;
this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0;
+ this.hideBackButton = (flags & FLAG_HIDE_BACK_BUTTON) != 0;
this.ordinal = id;
sAllStates[id] = this;
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index 89a9e2d..90d3821 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -35,7 +35,7 @@
private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE |
FLAG_DISABLE_ACCESSIBILITY | FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED |
- FLAG_DISABLE_PAGE_CLIPPING | FLAG_PAGE_BACKGROUNDS;
+ FLAG_DISABLE_PAGE_CLIPPING | FLAG_PAGE_BACKGROUNDS | FLAG_HIDE_BACK_BUTTON;
public SpringLoadedState(int id) {
super(id, ContainerType.OVERVIEW, SPRING_LOADED_TRANSITION_MS, STATE_FLAGS);