Merge "Fix "Pause work apps" button in strange location" into udc-dev
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index 21dfbe1..d4140d8 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -444,6 +444,9 @@
// 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 663fdb9..8c2fb19 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -166,7 +166,7 @@
return super.onApplyWindowInsets(insets);
}
- private void updateTranslationY() {
+ void updateTranslationY() {
setTranslationY(-mImeInsets.bottom);
}
@@ -180,6 +180,10 @@
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 30af502..44c233f 100644
--- a/src/com/android/launcher3/allapps/WorkProfileManager.java
+++ b/src/com/android/launcher3/allapps/WorkProfileManager.java
@@ -136,6 +136,11 @@
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) {