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

Bug: 137035518
Test: Manual
Change-Id: If624332b3f8344465676253a97d091e6545fe546
This commit is contained in:
Priyank Singh
2019-07-10 12:28:24 -07:00
parent d0d7e62026
commit 956c48252a
3 changed files with 20 additions and 1 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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(