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

Commit 956c4825 authored by Priyank Singh's avatar Priyank Singh
Browse files

Background color for notification shade should change with day/night mode.

Bug: 137035518
Test: Manual
Change-Id: If624332b3f8344465676253a97d091e6545fe546
parent d0d7e620
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
    <color name="status_bar_background_color">#ff000000</color>
    <color name="system_bar_background_opaque">#ff0c1013</color>

    <!-- The background color of the notification shade -->
    <color name="notification_shade_background_color">#E0000000</color>
    
    <!-- The color of the ripples on the untinted notifications -->
    <color name="notification_ripple_untinted_color">@color/ripple_material_dark</color>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
    <drawable name="system_bar_background">@android:color/transparent</drawable>

    <!-- The background color of the notification shade -->
    <color name="notification_shade_background_color">#DD000000</color>
    <color name="notification_shade_background_color">#D6000000</color>

    <!-- The background color of the car volume dialog -->
    <color name="car_volume_dialog_background_color">@color/system_bar_background_opaque</color>
+16 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.car.drivingstate.CarDrivingStateEvent;
import android.car.drivingstate.CarUxRestrictionsManager;
import android.car.hardware.power.CarPowerManager.CarPowerStateListener;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -1078,6 +1079,21 @@ public class CarStatusBar extends StatusBar implements
        }
    }

    @Override
    public void onConfigChanged(Configuration newConfig) {
        super.onConfigChanged(newConfig);

        int uiModeNightMask = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK);

        boolean dayNightModeChanged = uiModeNightMask == Configuration.UI_MODE_NIGHT_YES
                || uiModeNightMask == Configuration.UI_MODE_NIGHT_NO;

        if (dayNightModeChanged) {
            mNotificationView.setBackgroundColor(
                    mContext.getColor(R.color.notification_shade_background_color));
        }
    }

    private void calculatePercentageFromBottom(float height) {
        if (mNotificationView.getHeight() > 0) {
            mPercentageFromBottom = (int) Math.abs(