From b8ddc944ffeabf4758cf3cad316f00ae3b1f8750 Mon Sep 17 00:00:00 2001 From: Sukesh Ram Date: Thu, 30 Nov 2023 22:54:29 +0000 Subject: [PATCH] Fix 3-Button Color w/ Widget Sheet post-Rotation Fixed issue where upon opening the widgets menu in the home screen in landscape, then rotating screen to portrait, then back to landscape (whilst keeping widget sheet open), the buttons are dim colored rather than white. Flag: NONE Test: Manually tested in pixel 7 in light mode and dark mode (with home screen rotation enabled). Bug: 284801356 Change-Id: I0ed59373eb3af5f1b5ab695b43b850777042d2eb --- .../launcher3/widget/BaseWidgetSheet.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java index 26e191d19e..c3fcd5dc4f 100644 --- a/src/com/android/launcher3/widget/BaseWidgetSheet.java +++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java @@ -109,6 +109,7 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView mNavBarScrimPaint.setColor(navBarScrimColor); invalidate(); } + setupNavBarColor(); } @Override @@ -228,10 +229,18 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView } protected void setupNavBarColor() { - boolean isSheetDark = Themes.getAttrBoolean(getContext(), R.attr.isMainColorDark); - getSystemUiController().updateUiState( - SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET, - isSheetDark ? SystemUiController.FLAG_DARK_NAV : SystemUiController.FLAG_LIGHT_NAV); + boolean isNavBarDark = Themes.getAttrBoolean(getContext(), R.attr.isMainColorDark); + + // In light mode, landscape reverses navbar background color. + boolean isPhoneLandscape = + !mActivityContext.getDeviceProfile().isTablet && mInsets.bottom == 0; + if (!isNavBarDark && isPhoneLandscape) { + isNavBarDark = true; + } + + getSystemUiController().updateUiState(SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET, + isNavBarDark ? SystemUiController.FLAG_DARK_NAV + : SystemUiController.FLAG_LIGHT_NAV); } protected SystemUiController getSystemUiController() {