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

Commit 3285da35 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Nav bar should change to light theme in sync with the status bar

b/33708486

Nav bar should be in sync with status bar in all apps screen.
Nave bar should not change with status bar when in workspace mode.

Change-Id: Ib5a0d33d3e38f1b3ffa9693657ba7de3b6e01fed
parent 90a40570
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -475,9 +475,13 @@ public class Launcher extends Activity
            mExtractedColors.load(this);
            mHotseat.updateColor(mExtractedColors, !mPaused);
            mWorkspace.getPageIndicator().updateColor(mExtractedColors);
            boolean lightStatusBar = (FeatureFlags.LIGHT_STATUS_BAR
                    && mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
                    ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT);
            // It's possible that All Apps is visible when this is run,
            // so always use light status bar in that case.
            activateLightStatusBar(isAllAppsVisible(), false);
            // so always use light status bar in that case. Only change nav bar color to status bar
            // color when All Apps is visible.
            activateLightStatusBar(lightStatusBar || isAllAppsVisible(), isAllAppsVisible());
        }
    }

@@ -486,28 +490,24 @@ public class Launcher extends Activity

    /**
     * Sets the status bar to be light or not. Light status bar means dark icons.
     * @param activate if true, make sure the status bar is light, otherwise base on wallpaper.
     * @param changeNavBar make sure the nav bar is light only if this param and {@param activate}
     *                     is also true.
     * @param lightStatusBar make sure the status bar is light
     * @param changeNavBar if true, make the nav bar theme in sync with status bar.
     */
    public void activateLightStatusBar(boolean activate, boolean changeNavBar) {
        boolean lightStatusBar = activate || (FeatureFlags.LIGHT_STATUS_BAR
                && mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
                ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT);
    public void activateLightStatusBar(boolean lightStatusBar, boolean changeNavBar) {
        int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
        int newSystemUiFlags = oldSystemUiFlags;
        if (lightStatusBar) {
            newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR ;
        } else {
            newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }
        if (Utilities.isAtLeastO() && activate) {
            if (changeNavBar) {
            if (changeNavBar && Utilities.isAtLeastO()) {
                newSystemUiFlags |= SYSTEM_UI_FLAG_LIGHT_NAV_BAR;
            }
        } else {
            newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
            if (changeNavBar && Utilities.isAtLeastO()) {
                newSystemUiFlags &= ~(SYSTEM_UI_FLAG_LIGHT_NAV_BAR);
            }
        }

        if (newSystemUiFlags != oldSystemUiFlags) {
            getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags);
        }
+1 −1
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
        // Use a light status bar (dark icons) if all apps is behind at least half of the status
        // bar. If the status bar is already light due to wallpaper extraction, keep it that way.
        boolean forceLight = shift <= mStatusBarHeight / 2;
        mLauncher.activateLightStatusBar(forceLight, forceLight);
        mLauncher.activateLightStatusBar(forceLight, true);
    }

    /**