Loading packages/SystemUI/res/drawable/notification_material_bg_dim.xml +8 −4 Original line number Diff line number Diff line Loading @@ -14,7 +14,11 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <ripple xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="@color/notification_material_background_dimmed_color" /> <corners android:radius="@dimen/notification_material_rounded_rect_radius" /> </shape> </item> </ripple> packages/SystemUI/res/values/colors.xml +4 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,10 @@ <color name="notification_material_background_media_default_color">#ff424242</color> <!-- The color of the ripples on the untinted notifications --> <color name="notification_ripple_untinted_color">#20000000</color> <color name="notification_ripple_untinted_color">#28000000</color> <!-- The color of the ripples on the low priority notifications --> <color name="notification_ripple_color_low_priority">#30000000</color> <!-- The color of the ripples on the tinted notifications --> <color name="notification_ripple_tinted_color">#30ffffff</color> Loading packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +34 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView = new PathInterpolator(0.6f, 0, 0.5f, 1); private static final Interpolator ACTIVATE_INVERSE_ALPHA_INTERPOLATOR = new PathInterpolator(0, 0, 0.5f, 1); private final int mTintedRippleColor; private final int mLowPriorityRippleColor; private final int mNormalRippleColor; private boolean mDimmed; private boolean mDark; Loading Loading @@ -153,6 +156,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mNormalColor = getResources().getColor(R.color.notification_material_background_color); mLowPriorityColor = getResources().getColor( R.color.notification_material_background_low_priority_color); mTintedRippleColor = context.getResources().getColor( R.color.notification_ripple_tinted_color); mLowPriorityRippleColor = context.getResources().getColor( R.color.notification_ripple_color_low_priority); mNormalRippleColor = context.getResources().getColor( R.color.notification_ripple_untinted_color); } @Override Loading Loading @@ -191,6 +200,16 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } @Override protected void drawableStateChanged() { super.drawableStateChanged(); if (mDimmed) { mBackgroundDimmed.setState(getDrawableState()); } else { mBackgroundNormal.setState(getDrawableState()); } } private boolean handleTouchEventDimmed(MotionEvent event) { int action = event.getActionMasked(); switch (action) { Loading Loading @@ -372,12 +391,15 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private void updateBackgroundTint() { int color = getBackgroundColor(); int rippleColor = getRippleColor(); if (color == mNormalColor) { // We don't need to tint a normal notification color = 0; } mBackgroundDimmed.setTint(color); mBackgroundNormal.setTint(color); mBackgroundDimmed.setRippleColor(rippleColor); mBackgroundNormal.setRippleColor(rippleColor); } private void fadeBackground() { Loading Loading @@ -618,6 +640,18 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } private int getRippleColor() { if (mBgTint != 0) { return mTintedRippleColor; } else if (mShowingLegacyBackground) { return mTintedRippleColor; } else if (mIsBelowSpeedBump) { return mLowPriorityRippleColor; } else { return mNormalRippleColor; } } /** * When we draw the appear animation, we render the view in a bitmap and render this bitmap * as a shader of a rect. This call creates the Bitmap and switches the drawing mode, Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +11 −13 Original line number Diff line number Diff line Loading @@ -35,15 +35,9 @@ public class NotificationBackgroundView extends View { private Drawable mBackground; private int mClipTopAmount; private int mActualHeight; private final int mTintedRippleColor; private final int mNormalRippleColor; public NotificationBackgroundView(Context context, AttributeSet attrs) { super(context, attrs); mTintedRippleColor = context.getResources().getColor( R.color.notification_ripple_tinted_color); mNormalRippleColor = context.getResources().getColor( R.color.notification_ripple_untinted_color); } @Override Loading Loading @@ -103,17 +97,10 @@ public class NotificationBackgroundView extends View { } public void setTint(int tintColor) { int rippleColor; if (tintColor != 0) { mBackground.setColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP); rippleColor = mTintedRippleColor; } else { mBackground.clearColorFilter(); rippleColor = mNormalRippleColor; } if (mBackground instanceof RippleDrawable) { RippleDrawable ripple = (RippleDrawable) mBackground; ripple.setColor(ColorStateList.valueOf(rippleColor)); } invalidate(); } Loading @@ -138,4 +125,15 @@ public class NotificationBackgroundView extends View { // Prevents this view from creating a layer when alpha is animating. return false; } public void setState(int[] drawableState) { mBackground.setState(drawableState); } public void setRippleColor(int color) { if (mBackground instanceof RippleDrawable) { RippleDrawable ripple = (RippleDrawable) mBackground; ripple.setColor(ColorStateList.valueOf(color)); } } } Loading
packages/SystemUI/res/drawable/notification_material_bg_dim.xml +8 −4 Original line number Diff line number Diff line Loading @@ -14,7 +14,11 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <ripple xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="@color/notification_material_background_dimmed_color" /> <corners android:radius="@dimen/notification_material_rounded_rect_radius" /> </shape> </item> </ripple>
packages/SystemUI/res/values/colors.xml +4 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,10 @@ <color name="notification_material_background_media_default_color">#ff424242</color> <!-- The color of the ripples on the untinted notifications --> <color name="notification_ripple_untinted_color">#20000000</color> <color name="notification_ripple_untinted_color">#28000000</color> <!-- The color of the ripples on the low priority notifications --> <color name="notification_ripple_color_low_priority">#30000000</color> <!-- The color of the ripples on the tinted notifications --> <color name="notification_ripple_tinted_color">#30ffffff</color> Loading
packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +34 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView = new PathInterpolator(0.6f, 0, 0.5f, 1); private static final Interpolator ACTIVATE_INVERSE_ALPHA_INTERPOLATOR = new PathInterpolator(0, 0, 0.5f, 1); private final int mTintedRippleColor; private final int mLowPriorityRippleColor; private final int mNormalRippleColor; private boolean mDimmed; private boolean mDark; Loading Loading @@ -153,6 +156,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mNormalColor = getResources().getColor(R.color.notification_material_background_color); mLowPriorityColor = getResources().getColor( R.color.notification_material_background_low_priority_color); mTintedRippleColor = context.getResources().getColor( R.color.notification_ripple_tinted_color); mLowPriorityRippleColor = context.getResources().getColor( R.color.notification_ripple_color_low_priority); mNormalRippleColor = context.getResources().getColor( R.color.notification_ripple_untinted_color); } @Override Loading Loading @@ -191,6 +200,16 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } @Override protected void drawableStateChanged() { super.drawableStateChanged(); if (mDimmed) { mBackgroundDimmed.setState(getDrawableState()); } else { mBackgroundNormal.setState(getDrawableState()); } } private boolean handleTouchEventDimmed(MotionEvent event) { int action = event.getActionMasked(); switch (action) { Loading Loading @@ -372,12 +391,15 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private void updateBackgroundTint() { int color = getBackgroundColor(); int rippleColor = getRippleColor(); if (color == mNormalColor) { // We don't need to tint a normal notification color = 0; } mBackgroundDimmed.setTint(color); mBackgroundNormal.setTint(color); mBackgroundDimmed.setRippleColor(rippleColor); mBackgroundNormal.setRippleColor(rippleColor); } private void fadeBackground() { Loading Loading @@ -618,6 +640,18 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } private int getRippleColor() { if (mBgTint != 0) { return mTintedRippleColor; } else if (mShowingLegacyBackground) { return mTintedRippleColor; } else if (mIsBelowSpeedBump) { return mLowPriorityRippleColor; } else { return mNormalRippleColor; } } /** * When we draw the appear animation, we render the view in a bitmap and render this bitmap * as a shader of a rect. This call creates the Bitmap and switches the drawing mode, Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +11 −13 Original line number Diff line number Diff line Loading @@ -35,15 +35,9 @@ public class NotificationBackgroundView extends View { private Drawable mBackground; private int mClipTopAmount; private int mActualHeight; private final int mTintedRippleColor; private final int mNormalRippleColor; public NotificationBackgroundView(Context context, AttributeSet attrs) { super(context, attrs); mTintedRippleColor = context.getResources().getColor( R.color.notification_ripple_tinted_color); mNormalRippleColor = context.getResources().getColor( R.color.notification_ripple_untinted_color); } @Override Loading Loading @@ -103,17 +97,10 @@ public class NotificationBackgroundView extends View { } public void setTint(int tintColor) { int rippleColor; if (tintColor != 0) { mBackground.setColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP); rippleColor = mTintedRippleColor; } else { mBackground.clearColorFilter(); rippleColor = mNormalRippleColor; } if (mBackground instanceof RippleDrawable) { RippleDrawable ripple = (RippleDrawable) mBackground; ripple.setColor(ColorStateList.valueOf(rippleColor)); } invalidate(); } Loading @@ -138,4 +125,15 @@ public class NotificationBackgroundView extends View { // Prevents this view from creating a layer when alpha is animating. return false; } public void setState(int[] drawableState) { mBackground.setState(drawableState); } public void setRippleColor(int color) { if (mBackground instanceof RippleDrawable) { RippleDrawable ripple = (RippleDrawable) mBackground; ripple.setColor(ColorStateList.valueOf(color)); } } }