am 5c1459f5: am dad13577: Merge "Update dark mode on notifications when content is updated" into lmp-mr1-dev

* commit '5c1459f5e4ac9687a5fe602efa5f9ad4992c94a1':
  Update dark mode on notifications when content is updated
This commit is contained in:
Jorim Jaggi
2014-12-02 19:49:32 +00:00
committed by Android Git Automerger
4 changed files with 24 additions and 35 deletions

View File

@@ -244,6 +244,9 @@ public class NotificationContentView extends FrameLayout {
public void notifyContentUpdated() { public void notifyContentUpdated() {
selectLayout(false /* animate */, true /* force */); selectLayout(false /* animate */, true /* force */);
if (mContractedChild != null) {
mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
}
} }
public boolean isContentExpandable() { public boolean isContentExpandable() {

View File

@@ -27,7 +27,6 @@ import com.android.systemui.statusbar.phone.NotificationPanelView;
public class NotificationCustomViewWrapper extends NotificationViewWrapper { public class NotificationCustomViewWrapper extends NotificationViewWrapper {
private final ViewInvertHelper mInvertHelper; private final ViewInvertHelper mInvertHelper;
private boolean mDark;
protected NotificationCustomViewWrapper(View view) { protected NotificationCustomViewWrapper(View view) {
super(view); super(view);
@@ -36,13 +35,10 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
@Override @Override
public void setDark(boolean dark, boolean fade, long delay) { public void setDark(boolean dark, boolean fade, long delay) {
if (mDark != dark) { if (fade) {
mDark = dark; mInvertHelper.fade(dark, delay);
if (fade) { } else {
mInvertHelper.fade(dark, delay); mInvertHelper.update(dark);
} else {
mInvertHelper.update(dark);
}
} }
} }
} }

View File

@@ -24,19 +24,14 @@ import android.view.View;
*/ */
public class NotificationMediaViewWrapper extends NotificationTemplateViewWrapper { public class NotificationMediaViewWrapper extends NotificationTemplateViewWrapper {
private boolean mDark;
protected NotificationMediaViewWrapper(Context ctx, View view) { protected NotificationMediaViewWrapper(Context ctx, View view) {
super(ctx, view); super(ctx, view);
} }
@Override @Override
public void setDark(boolean dark, boolean fade, long delay) { public void setDark(boolean dark, boolean fade, long delay) {
if (mDark != dark) {
mDark = dark;
// Only update the large icon, because the rest is already inverted. // Only update the large icon, because the rest is already inverted.
setPictureGrayscale(dark, fade, delay); setPictureGrayscale(dark, fade, delay);
}
} }
} }

View File

@@ -51,8 +51,6 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
private final int mIconBackgroundDarkColor; private final int mIconBackgroundDarkColor;
private final Interpolator mLinearOutSlowInInterpolator; private final Interpolator mLinearOutSlowInInterpolator;
private boolean mDark;
protected NotificationTemplateViewWrapper(Context ctx, View view) { protected NotificationTemplateViewWrapper(Context ctx, View view) {
super(view); super(view);
mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha); mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha);
@@ -95,26 +93,23 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
@Override @Override
public void setDark(boolean dark, boolean fade, long delay) { public void setDark(boolean dark, boolean fade, long delay) {
if (mDark != dark) { if (mInvertHelper != null) {
mDark = dark; if (fade) {
if (mInvertHelper != null) { mInvertHelper.fade(dark, delay);
if (fade) { } else {
mInvertHelper.fade(dark, delay); mInvertHelper.update(dark);
} else {
mInvertHelper.update(dark);
}
} }
if (mIcon != null) {
if (fade) {
fadeIconColorFilter(mIcon, dark, delay);
fadeIconAlpha(mIcon, dark, delay);
} else {
updateIconColorFilter(mIcon, dark);
updateIconAlpha(mIcon, dark);
}
}
setPictureGrayscale(dark, fade, delay);
} }
if (mIcon != null) {
if (fade) {
fadeIconColorFilter(mIcon, dark, delay);
fadeIconAlpha(mIcon, dark, delay);
} else {
updateIconColorFilter(mIcon, dark);
updateIconAlpha(mIcon, dark);
}
}
setPictureGrayscale(dark, fade, delay);
} }
protected void setPictureGrayscale(boolean grayscale, boolean fade, long delay) { protected void setPictureGrayscale(boolean grayscale, boolean fade, long delay) {