summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorBrandon Dayauon <brdayauon@google.com>2023-05-30 10:53:51 -0700
committerBrandon Dayauon <brdayauon@google.com>2023-05-31 20:23:26 +0000
commit6a14189b071180b8dfdbfa9e3860405b2e3c0a5b (patch)
tree9ce0945fb6aa8e5e139e9cf993b72e4eb1822d54 /src/com/android
parentdb7009544e418b5e38cf3a7e5012bc66e7cce832 (diff)
downloadLauncher3-6a14189b071180b8dfdbfa9e3860405b2e3c0a5b.tar.gz
Fix "Pause work apps" button in strange location
The issue why the button sticks up is because of the translation not resetting when closing All apps. - This CL resets ime insets and the position of the button to the original location. bug: 278722407 test: manual - before:https://drive.google.com/file/d/1_L4ICHrt582KcVcpvQDK9HciC_n5eiEy/view?usp=sharing after: https://drive.google.com/file/d/1_G8-Jd_wdUKjy7vFj6iQ1QmCx_7Qrogn/view?usp=sharing Change-Id: Ib32b8ef950d03aa812f30c2393e3cad3201c08da
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java3
-rw-r--r--src/com/android/launcher3/allapps/WorkModeSwitch.java6
-rw-r--r--src/com/android/launcher3/allapps/WorkProfileManager.java5
3 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index 21dfbe1d0c..d4140d851c 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -444,6 +444,9 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
// Animate to A-Z with 0 time to reset the animation with proper state management.
animateToSearchState(false, 0);
}
+ if (isSearching()) {
+ mWorkManager.reset();
+ }
}
@Override
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index 663fdb9822..8c2fb195c6 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -166,7 +166,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
return super.onApplyWindowInsets(insets);
}
- private void updateTranslationY() {
+ void updateTranslationY() {
setTranslationY(-mImeInsets.bottom);
}
@@ -180,6 +180,10 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
rect.set(insets.left, insets.top, insets.right, insets.bottom);
}
+ public Rect getImeInsets() {
+ return mImeInsets;
+ }
+
@Override
public void onTranslationStart() {
setFlag(FLAG_TRANSLATION_ONGOING);
diff --git a/src/com/android/launcher3/allapps/WorkProfileManager.java b/src/com/android/launcher3/allapps/WorkProfileManager.java
index 30af50261d..44c233f557 100644
--- a/src/com/android/launcher3/allapps/WorkProfileManager.java
+++ b/src/com/android/launcher3/allapps/WorkProfileManager.java
@@ -136,6 +136,11 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
public void reset() {
boolean isEnabled = !mAllApps.getAppsStore().hasModelFlag(FLAG_QUIET_MODE_ENABLED);
updateCurrentState(isEnabled ? STATE_ENABLED : STATE_DISABLED);
+ if (mWorkModeSwitch != null) {
+ // reset the position of the button and clear IME insets.
+ mWorkModeSwitch.getImeInsets().setEmpty();
+ mWorkModeSwitch.updateTranslationY();
+ }
}
private void updateCurrentState(@WorkProfileState int currentState) {