Merge "Make navigation bar color transparent by default"

This commit is contained in:
TreeHugger Robot
2023-02-15 20:52:13 +00:00
committed by Android (Google) Code Review
6 changed files with 30 additions and 6 deletions

View File

@@ -2507,12 +2507,23 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
final boolean targetPreQ = targetSdk < Build.VERSION_CODES.Q;
if (!mForcedStatusBarColor) {
mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000);
mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, Color.BLACK);
}
if (!mForcedNavigationBarColor) {
mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000);
final int navBarCompatibleColor = context.getColor(R.color.navigation_bar_compatible);
final int navBarDefaultColor = context.getColor(R.color.navigation_bar_default);
final int navBarColor = a.getColor(R.styleable.Window_navigationBarColor,
navBarDefaultColor);
mNavigationBarColor =
navBarColor == navBarDefaultColor
&& !context.getResources().getBoolean(
R.bool.config_navBarDefaultTransparent)
? navBarCompatibleColor
: navBarColor;
mNavigationBarDividerColor = a.getColor(R.styleable.Window_navigationBarDividerColor,
0x00000000);
Color.TRANSPARENT);
}
if (!targetPreQ) {
mEnsureStatusBarContrastWhenTransparent = a.getBoolean(

View File

@@ -573,4 +573,10 @@
<color name="side_fps_toast_background">#F7F9FA</color>
<color name="side_fps_text_color">#191C1D</color>
<color name="side_fps_button_color">#00677E</color>
<!-- Color for system bars -->
<color name="navigation_bar_compatible">@android:color/black</color>
<!-- This uses non-regular transparent intentionally. It is used to tell if the transparent
color is set by the framework or not. -->
<color name="navigation_bar_default">#00808080</color>
</resources>

View File

@@ -3878,6 +3878,10 @@
This should only be set when the device has gestural navigation enabled by default. -->
<bool name="config_showGesturalNavigationHints">false</bool>
<!-- Controls whether the navigation bar background color provided by the app is transparent by
default. This should be controlled in developer options. -->
<bool name="config_navBarDefaultTransparent">false</bool>
<!-- Controls the free snap mode for the docked stack divider. In this mode, the divider can be
snapped to any position between the first target and the last target. -->
<bool name="config_dockedStackDividerFreeSnapMode">false</bool>

View File

@@ -2996,6 +2996,9 @@
<java-symbol type="array" name="config_backGestureInsetScales" />
<java-symbol type="color" name="system_bar_background_semi_transparent" />
<java-symbol type="bool" name="config_showGesturalNavigationHints" />
<java-symbol type="bool" name="config_navBarDefaultTransparent" />
<java-symbol type="color" name="navigation_bar_default"/>
<java-symbol type="color" name="navigation_bar_compatible"/>
<!-- EditText suggestion popup. -->
<java-symbol type="id" name="suggestionWindowContainer" />

View File

@@ -191,7 +191,7 @@ please see themes_device_defaults.xml.
<item name="windowTranslucentNavigation">false</item>
<item name="windowDrawsSystemBarBackgrounds">false</item>
<item name="statusBarColor">@color/black</item>
<item name="navigationBarColor">@color/black</item>
<item name="navigationBarColor">@color/navigation_bar_default</item>
<item name="windowActionBarFullscreenDecorLayout">@layout/screen_action_bar</item>
<item name="windowContentTransitions">false</item>
<item name="windowActivityTransitions">false</item>

View File

@@ -175,7 +175,7 @@ please see themes_device_defaults.xml.
<item name="windowDrawsSystemBarBackgrounds">true</item>
<item name="windowActionBarFullscreenDecorLayout">@layout/screen_toolbar</item>
<item name="statusBarColor">?attr/colorPrimaryDark</item>
<item name="navigationBarColor">@color/black</item>
<item name="navigationBarColor">@color/navigation_bar_default</item>
<item name="windowEnterTransition">@transition/fade</item>
<item name="windowSharedElementEnterTransition">@transition/move</item>
<item name="windowSharedElementExitTransition">@transition/move</item>
@@ -548,7 +548,7 @@ please see themes_device_defaults.xml.
<item name="windowDrawsSystemBarBackgrounds">true</item>
<item name="windowActionBarFullscreenDecorLayout">@layout/screen_toolbar</item>
<item name="statusBarColor">?attr/colorPrimaryDark</item>
<item name="navigationBarColor">@color/black</item>
<item name="navigationBarColor">@color/navigation_bar_default</item>
<item name="windowEnterTransition">@transition/fade</item>
<item name="windowSharedElementEnterTransition">@transition/move</item>
<item name="windowSharedElementExitTransition">@transition/move</item>