am 46a63c20: am 48308602: am e25ac583: Merge "Notification: Optimize L icon processing" into lmp-dev

* commit '46a63c20759747e0aef2b76d3a378013f6084d04':
  Notification: Optimize L icon processing
This commit is contained in:
Christoph Studer
2014-08-26 22:16:22 +00:00
committed by Android Git Automerger
3 changed files with 12 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ import android.media.AudioManager;
import android.media.session.MediaSession;
import android.net.Uri;
import android.os.BadParcelableException;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -1904,7 +1905,8 @@ public class Notification implements Parcelable
mPriority = PRIORITY_DEFAULT;
mPeople = new ArrayList<String>();
mColorUtil = NotificationColorUtil.getInstance();
mColorUtil = context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.L ?
NotificationColorUtil.getInstance() : null;
}
/**
@@ -2610,7 +2612,7 @@ public class Notification implements Parcelable
if (mLargeIcon != null) {
contentView.setImageViewBitmap(R.id.icon, mLargeIcon);
processLargeIcon(mLargeIcon, contentView);
processLargeLegacyIcon(mLargeIcon, contentView);
contentView.setImageViewResource(R.id.right_icon, mSmallIcon);
contentView.setViewVisibility(R.id.right_icon, View.VISIBLE);
processSmallRightIcon(mSmallIcon, contentView);
@@ -2813,13 +2815,10 @@ public class Notification implements Parcelable
}
private void processLegacyAction(Action action, RemoteViews button) {
if (isLegacy()) {
if (mColorUtil.isGrayscale(mContext, action.icon)) {
button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0,
mContext.getResources().getColor(
R.color.notification_action_legacy_color_filter),
PorterDuff.Mode.MULTIPLY);
}
if (!isLegacy() || mColorUtil.isGrayscale(mContext, action.icon)) {
button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0,
mContext.getResources().getColor(R.color.notification_action_color_filter),
PorterDuff.Mode.MULTIPLY);
}
}
@@ -2845,8 +2844,8 @@ public class Notification implements Parcelable
* if it's grayscale).
*/
// TODO: also check bounds, transparency, that sort of thing.
private void processLargeIcon(Bitmap largeIcon, RemoteViews contentView) {
if (!isLegacy() || mColorUtil.isGrayscale(largeIcon)) {
private void processLargeLegacyIcon(Bitmap largeIcon, RemoteViews contentView) {
if (isLegacy() && mColorUtil.isGrayscale(largeIcon)) {
applyLargeIconBackground(contentView);
} else {
removeLargeIconBackground(contentView);

View File

@@ -130,7 +130,7 @@
<drawable name="notification_template_divider">#29000000</drawable>
<color name="notification_icon_bg_color">#ff9e9e9e</color>
<color name="notification_action_legacy_color_filter">#ff555555</color>
<color name="notification_action_color_filter">@color/secondary_text_material_light</color>
<color name="notification_media_action_bg">#00000000</color>
<color name="notification_media_progress">#FFFFFFFF</color>

View File

@@ -1718,7 +1718,7 @@
<java-symbol type="layout" name="notification_template_material_big_text" />
<java-symbol type="layout" name="notification_template_icon_group" />
<java-symbol type="layout" name="notification_material_media_action" />
<java-symbol type="color" name="notification_action_legacy_color_filter" />
<java-symbol type="color" name="notification_action_color_filter" />
<java-symbol type="color" name="notification_icon_bg_color" />
<java-symbol type="drawable" name="notification_icon_legacy_bg" />
<java-symbol type="drawable" name="notification_material_media_progress" />