From 7450874e28b4ff617f3b1a9c5f25bb356719c44d Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 18 Jan 2023 15:34:19 -0800 Subject: [PATCH] Fixing while navication bar in all-apps in 3-button mode. Launcher was not accounting for all-apps-nav-bar-scrim when computing sysui-flags Bug: 194486821 Test: Verified on device Change-Id: I692977fba5999bbab9737bac4b27c15c2912e6af --- .../allapps/AllAppsTransitionController.java | 18 +++++++++++++++++- .../allapps/BaseAllAppsContainerView.java | 11 +++++++++-- .../allapps/LauncherAllAppsContainerView.java | 2 +- .../launcher3/util/SystemUiController.java | 3 ++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 6f6f86b105..f7b0d966f9 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -25,6 +25,9 @@ import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; +import static com.android.launcher3.util.SystemUiController.FLAG_DARK_NAV; +import static com.android.launcher3.util.SystemUiController.FLAG_LIGHT_NAV; +import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS; import android.animation.Animator; import android.animation.Animator.AnimatorListener; @@ -54,6 +57,7 @@ import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; import com.android.launcher3.util.MultiValueAlpha; +import com.android.launcher3.util.Themes; import com.android.launcher3.views.ScrimView; /** @@ -73,6 +77,8 @@ public class AllAppsTransitionController public static final float SWIPE_ALL_APPS_TO_HOME_MIN_SCALE = 0.9f; private static final int REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS = 200; + private static final float NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.1f; + public static final FloatProperty ALL_APPS_PROGRESS = new FloatProperty("allAppsProgress") { @@ -151,6 +157,8 @@ public class AllAppsTransitionController private final Launcher mLauncher; private final AnimatedFloat mAllAppScale = new AnimatedFloat(this::onScaleProgressChanged); + private final int mNavScrimFlag; + private boolean mIsVerticalLayout; // Whether this class should take care of closing the keyboard. @@ -177,10 +185,13 @@ public class AllAppsTransitionController public AllAppsTransitionController(Launcher l) { mLauncher = l; DeviceProfile dp = mLauncher.getDeviceProfile(); - setShiftRange(dp.allAppsShiftRange); mProgress = 1f; mIsVerticalLayout = dp.isVerticalBarLayout(); mIsTablet = dp.isTablet; + mNavScrimFlag = Themes.getAttrBoolean(l, R.attr.isMainColorDark) + ? FLAG_DARK_NAV : FLAG_LIGHT_NAV; + + setShiftRange(dp.allAppsShiftRange); mLauncher.addOnDeviceProfileChangeListener(this); } @@ -213,6 +224,11 @@ public class AllAppsTransitionController mProgress = progress; getAppsViewProgressTranslationY().setValue(mProgress * mShiftRange); mLauncher.onAllAppsTransition(1 - progress); + + boolean hasScrim = progress < NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD + && mLauncher.getAppsView().getNavBarScrimHeight() > 0; + mLauncher.getSystemUiController().updateUiState( + UI_STATE_ALL_APPS, hasScrim ? mNavScrimFlag : 0); } public float getProgress() { diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index 1c676915fd..9bb825084b 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -520,13 +520,20 @@ public abstract class BaseAllAppsContainerView