summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java5
3 files changed, 34 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 2934327..914b3d8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -246,6 +246,7 @@ public class NotificationContentView extends FrameLayout {
public void notifyContentUpdated() {
selectLayout(false /* animate */, true /* force */);
if (mContractedChild != null) {
+ mContractedWrapper.notifyContentUpdated();
mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
index 5b6e1cd..fbcba0b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
@@ -26,6 +26,7 @@ import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
+import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
@@ -40,17 +41,18 @@ import com.android.systemui.statusbar.phone.NotificationPanelView;
*/
public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
- private final ViewInvertHelper mInvertHelper;
- private final ImageView mIcon;
- protected final ImageView mPicture;
private final ColorMatrix mGrayscaleColorMatrix = new ColorMatrix();
private final PorterDuffColorFilter mIconColorFilter = new PorterDuffColorFilter(
0, PorterDuff.Mode.SRC_ATOP);
private final int mIconDarkAlpha;
- private final int mIconBackgroundColor;
private final int mIconBackgroundDarkColor;
private final Interpolator mLinearOutSlowInInterpolator;
+ private int mIconBackgroundColor;
+ private ViewInvertHelper mInvertHelper;
+ private ImageView mIcon;
+ protected ImageView mPicture;
+
protected NotificationTemplateViewWrapper(Context ctx, View view) {
super(view);
mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha);
@@ -58,12 +60,16 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
ctx.getResources().getColor(R.color.doze_small_icon_background_color);
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(ctx,
android.R.interpolator.linear_out_slow_in);
- View mainColumn = view.findViewById(com.android.internal.R.id.notification_main_column);
+ resolveViews();
+ }
+
+ private void resolveViews() {
+ View mainColumn = mView.findViewById(com.android.internal.R.id.notification_main_column);
mInvertHelper = mainColumn != null
? new ViewInvertHelper(mainColumn, NotificationPanelView.DOZE_ANIMATION_DURATION)
: null;
- ImageView largeIcon = (ImageView) view.findViewById(com.android.internal.R.id.icon);
- ImageView rightIcon = (ImageView) view.findViewById(com.android.internal.R.id.right_icon);
+ ImageView largeIcon = (ImageView) mView.findViewById(com.android.internal.R.id.icon);
+ ImageView rightIcon = (ImageView) mView.findViewById(com.android.internal.R.id.right_icon);
mIcon = resolveIcon(largeIcon, rightIcon);
mPicture = resolvePicture(largeIcon);
mIconBackgroundColor = resolveBackgroundColor(mIcon);
@@ -92,6 +98,14 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
}
@Override
+ public void notifyContentUpdated() {
+ super.notifyContentUpdated();
+
+ // Reinspect the notification.
+ resolveViews();
+ }
+
+ @Override
public void setDark(boolean dark, boolean fade, long delay) {
if (mInvertHelper != null) {
if (fade) {
@@ -180,7 +194,13 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
private void updateIconColorFilter(ImageView target, float intensity) {
int color = interpolateColor(mIconBackgroundColor, mIconBackgroundDarkColor, intensity);
mIconColorFilter.setColor(color);
- target.getBackground().mutate().setColorFilter(mIconColorFilter);
+ Drawable background = target.getBackground();
+
+ // The notification might have been modified during the animation, so background might be
+ // null here.
+ if (background != null) {
+ background.mutate().setColorFilter(mIconColorFilter);
+ }
}
private void updateIconAlpha(ImageView target, boolean dark) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
index 0a02573..78b9739 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
@@ -53,4 +53,9 @@ public abstract class NotificationViewWrapper {
* @param delay if fading, the delay of the animation
*/
public abstract void setDark(boolean dark, boolean fade, long delay);
+
+ /**
+ * Notifies this wrapper that the content of the view might have changed.
+ */
+ public void notifyContentUpdated() {}
}