Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8b63cf5 authored by Tiger's avatar Tiger
Browse files

Make navigation bar color transparent by default

This CL only changes the default color from black to transparent. If an
app specifies the navigation color from the resource or programatically,
its color will still be applied.

This feature is only enabled when config_navBarDefaultTransparent is
enabled.

Fix: 232195501
Test: Open Pixel Logger or NetGrapher with the combinations of:
      1. gesture navigation or 3-button navigation
      2. light theme or dark theme
Change-Id: I9f1fd67e1c42cc732accba2260e0374cbc495041
parent 722601a8
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -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(
+6 −0
Original line number Diff line number Diff line
@@ -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>
+4 −0
Original line number Diff line number Diff line
@@ -3876,6 +3876,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>
+3 −0
Original line number Diff line number Diff line
@@ -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" />
+1 −1
Original line number Diff line number Diff line
@@ -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>
Loading