Merge "Use a color resource to specify the dim behind panels." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
41f71dc814
@@ -33,4 +33,5 @@
|
||||
<drawable name="system_bar_background">#ff000000</drawable>
|
||||
<!-- the darkening filter applied to notifications -->
|
||||
<drawable name="notification_icon_area_smoke">#aa000000</drawable>
|
||||
<color name="notification_panel_scrim_color">#B0000000</color>
|
||||
</resources>
|
||||
|
||||
@@ -109,7 +109,6 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
public static final String ACTION_STATUSBAR_START
|
||||
= "com.android.internal.policy.statusbar.START";
|
||||
|
||||
public static final boolean DIM_BEHIND_EXPANDED_PANEL = true;
|
||||
private static final boolean SHOW_CARRIER_LABEL = true;
|
||||
|
||||
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
|
||||
|
||||
@@ -19,7 +19,9 @@ package com.android.systemui.statusbar.phone;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.os.SystemClock;
|
||||
import android.util.AttributeSet;
|
||||
@@ -39,6 +41,7 @@ import com.android.systemui.statusbar.policy.FixedSizeDrawable;
|
||||
public class PhoneStatusBarView extends PanelBar {
|
||||
private static final String TAG = "PhoneStatusBarView";
|
||||
PhoneStatusBar mBar;
|
||||
int mScrimColor;
|
||||
|
||||
public PhoneStatusBarView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -48,6 +51,12 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
mBar = bar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
Resources res = getContext().getResources();
|
||||
mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
|
||||
if (super.onRequestSendAccessibilityEvent(child, event)) {
|
||||
@@ -89,10 +98,11 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
public void panelExpansionChanged(PanelView pv, float frac) {
|
||||
super.panelExpansionChanged(pv, frac);
|
||||
|
||||
if (PhoneStatusBar.DIM_BEHIND_EXPANDED_PANEL && ActivityManager.isHighEndGfx(mBar.mDisplay)) {
|
||||
if (mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) {
|
||||
// woo, special effects
|
||||
final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f))));
|
||||
final int color = ((int)(0xB0 * k)) << 24;
|
||||
// attenuate background color alpha by k
|
||||
final int color = (int) ((float)(mScrimColor >>> 24) * k) << 24 | (mScrimColor & 0xFFFFFF);
|
||||
mBar.mStatusBarWindow.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user