Loading core/java/android/app/Notification.java +32 −13 Original line number Diff line number Diff line Loading @@ -3898,7 +3898,7 @@ public class Notification implements Parcelable boolean showProgress = handleProgressBar(p.hasProgress, contentView, ex); if (p.title != null) { contentView.setViewVisibility(R.id.title, View.VISIBLE); contentView.setTextViewText(R.id.title, p.title); contentView.setTextViewText(R.id.title, processTextSpans(p.title)); if (!p.ambient) { setTextViewColorPrimary(contentView, R.id.title); } Loading @@ -3909,7 +3909,7 @@ public class Notification implements Parcelable if (p.text != null) { int textId = showProgress ? com.android.internal.R.id.text_line_1 : com.android.internal.R.id.text; contentView.setTextViewText(textId, p.text); contentView.setTextViewText(textId, processTextSpans(p.text)); if (!p.ambient) { setTextViewColorSecondary(contentView, textId); } Loading @@ -3921,11 +3921,22 @@ public class Notification implements Parcelable return contentView; } private CharSequence processTextSpans(CharSequence text) { if (hasForegroundColor()) { return clearColorSpans(text); } return text; } private void setTextViewColorPrimary(RemoteViews contentView, int id) { ensureColors(); contentView.setTextColor(id, mPrimaryTextColor); } private boolean hasForegroundColor() { return mForegroundColor != COLOR_INVALID; } /** * @return the primary text color * @hide Loading Loading @@ -3968,7 +3979,7 @@ public class Notification implements Parcelable || mActionBarColor == COLOR_INVALID || mTextColorsAreForBackground != backgroundColor) { mTextColorsAreForBackground = backgroundColor; if (mForegroundColor == COLOR_INVALID || !isColorized()) { if (!hasForegroundColor() || !isColorized()) { mPrimaryTextColor = NotificationColorUtil.resolvePrimaryColor(mContext, backgroundColor); mSecondaryTextColor = NotificationColorUtil.resolveSecondaryColor(mContext, Loading Loading @@ -4219,7 +4230,8 @@ public class Notification implements Parcelable } if (headerText != null) { // TODO: Remove the span entirely to only have the string with propper formating. contentView.setTextViewText(R.id.header_text, processLegacyText(headerText)); contentView.setTextViewText(R.id.header_text, processTextSpans( processLegacyText(headerText))); setTextViewColorSecondary(contentView, R.id.header_text); contentView.setViewVisibility(R.id.header_text, View.VISIBLE); contentView.setViewVisibility(R.id.header_text_divider, View.VISIBLE); Loading Loading @@ -4350,18 +4362,21 @@ public class Notification implements Parcelable if (!p.ambient && validRemoteInput && replyText != null && replyText.length > 0 && !TextUtils.isEmpty(replyText[0])) { big.setViewVisibility(R.id.notification_material_reply_container, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_1, replyText[0]); big.setTextViewText(R.id.notification_material_reply_text_1, processTextSpans(replyText[0])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_1); if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1])) { big.setViewVisibility(R.id.notification_material_reply_text_2, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_2, replyText[1]); big.setTextViewText(R.id.notification_material_reply_text_2, processTextSpans(replyText[1])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_2); if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2])) { big.setViewVisibility( R.id.notification_material_reply_text_3, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_3, replyText[2]); big.setTextViewText(R.id.notification_material_reply_text_3, processTextSpans(replyText[2])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_3); } } Loading Loading @@ -4673,7 +4688,7 @@ public class Notification implements Parcelable outResultColor = new ColorStateList[1]; title = ensureColorSpanContrast(title, bgColor, outResultColor); } button.setTextViewText(R.id.action0, title); button.setTextViewText(R.id.action0, processTextSpans(title)); setTextViewColorPrimary(button, R.id.action0); if (outResultColor != null && outResultColor[0] != null) { // We need to set the text color as well since changing a text to uppercase Loading @@ -4683,7 +4698,8 @@ public class Notification implements Parcelable button.setTextColor(R.id.action0,resolveContrastColor()); } } else { button.setTextViewText(R.id.action0, processLegacyText(action.title)); button.setTextViewText(R.id.action0, processTextSpans( processLegacyText(action.title))); if (isColorized() && !ambient) { setTextViewColorPrimary(button, R.id.action0); } else if (mN.color != COLOR_DEFAULT && mTintActionButtons) { Loading Loading @@ -5682,7 +5698,8 @@ public class Notification implements Parcelable RemoteViews contentView = getStandardView(mBuilder.getBigPictureLayoutResource()); if (mSummaryTextSet) { contentView.setTextViewText(R.id.text, mBuilder.processLegacyText(mSummaryText)); contentView.setTextViewText(R.id.text, mBuilder.processTextSpans( mBuilder.processLegacyText(mSummaryText))); mBuilder.setTextViewColorSecondary(contentView, R.id.text); contentView.setViewVisibility(R.id.text, View.VISIBLE); } Loading Loading @@ -5864,7 +5881,7 @@ public class Notification implements Parcelable static void applyBigTextContentView(Builder builder, RemoteViews contentView, CharSequence bigTextText) { contentView.setTextViewText(R.id.big_text, bigTextText); contentView.setTextViewText(R.id.big_text, builder.processTextSpans(bigTextText)); builder.setTextViewColorSecondary(contentView, R.id.big_text); contentView.setViewVisibility(R.id.big_text, TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE); Loading Loading @@ -6199,7 +6216,8 @@ public class Notification implements Parcelable int rowId = rowIds[i]; contentView.setViewVisibility(rowId, View.VISIBLE); contentView.setTextViewText(rowId, makeMessageLine(m, mBuilder)); contentView.setTextViewText(rowId, mBuilder.processTextSpans( makeMessageLine(m, mBuilder))); mBuilder.setTextViewColorSecondary(contentView, rowId); if (contractedMessage == m) { Loading Loading @@ -6565,7 +6583,8 @@ public class Notification implements Parcelable CharSequence str = mTexts.get(i); if (!TextUtils.isEmpty(str)) { contentView.setViewVisibility(rowIds[i], View.VISIBLE); contentView.setTextViewText(rowIds[i], mBuilder.processLegacyText(str)); contentView.setTextViewText(rowIds[i], mBuilder.processTextSpans(mBuilder.processLegacyText(str))); mBuilder.setTextViewColorSecondary(contentView, rowIds[i]); contentView.setViewPadding(rowIds[i], 0, topPadding, 0, 0); handleInboxImageMargin(contentView, rowIds[i], first); Loading Loading
core/java/android/app/Notification.java +32 −13 Original line number Diff line number Diff line Loading @@ -3898,7 +3898,7 @@ public class Notification implements Parcelable boolean showProgress = handleProgressBar(p.hasProgress, contentView, ex); if (p.title != null) { contentView.setViewVisibility(R.id.title, View.VISIBLE); contentView.setTextViewText(R.id.title, p.title); contentView.setTextViewText(R.id.title, processTextSpans(p.title)); if (!p.ambient) { setTextViewColorPrimary(contentView, R.id.title); } Loading @@ -3909,7 +3909,7 @@ public class Notification implements Parcelable if (p.text != null) { int textId = showProgress ? com.android.internal.R.id.text_line_1 : com.android.internal.R.id.text; contentView.setTextViewText(textId, p.text); contentView.setTextViewText(textId, processTextSpans(p.text)); if (!p.ambient) { setTextViewColorSecondary(contentView, textId); } Loading @@ -3921,11 +3921,22 @@ public class Notification implements Parcelable return contentView; } private CharSequence processTextSpans(CharSequence text) { if (hasForegroundColor()) { return clearColorSpans(text); } return text; } private void setTextViewColorPrimary(RemoteViews contentView, int id) { ensureColors(); contentView.setTextColor(id, mPrimaryTextColor); } private boolean hasForegroundColor() { return mForegroundColor != COLOR_INVALID; } /** * @return the primary text color * @hide Loading Loading @@ -3968,7 +3979,7 @@ public class Notification implements Parcelable || mActionBarColor == COLOR_INVALID || mTextColorsAreForBackground != backgroundColor) { mTextColorsAreForBackground = backgroundColor; if (mForegroundColor == COLOR_INVALID || !isColorized()) { if (!hasForegroundColor() || !isColorized()) { mPrimaryTextColor = NotificationColorUtil.resolvePrimaryColor(mContext, backgroundColor); mSecondaryTextColor = NotificationColorUtil.resolveSecondaryColor(mContext, Loading Loading @@ -4219,7 +4230,8 @@ public class Notification implements Parcelable } if (headerText != null) { // TODO: Remove the span entirely to only have the string with propper formating. contentView.setTextViewText(R.id.header_text, processLegacyText(headerText)); contentView.setTextViewText(R.id.header_text, processTextSpans( processLegacyText(headerText))); setTextViewColorSecondary(contentView, R.id.header_text); contentView.setViewVisibility(R.id.header_text, View.VISIBLE); contentView.setViewVisibility(R.id.header_text_divider, View.VISIBLE); Loading Loading @@ -4350,18 +4362,21 @@ public class Notification implements Parcelable if (!p.ambient && validRemoteInput && replyText != null && replyText.length > 0 && !TextUtils.isEmpty(replyText[0])) { big.setViewVisibility(R.id.notification_material_reply_container, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_1, replyText[0]); big.setTextViewText(R.id.notification_material_reply_text_1, processTextSpans(replyText[0])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_1); if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1])) { big.setViewVisibility(R.id.notification_material_reply_text_2, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_2, replyText[1]); big.setTextViewText(R.id.notification_material_reply_text_2, processTextSpans(replyText[1])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_2); if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2])) { big.setViewVisibility( R.id.notification_material_reply_text_3, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_3, replyText[2]); big.setTextViewText(R.id.notification_material_reply_text_3, processTextSpans(replyText[2])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_3); } } Loading Loading @@ -4673,7 +4688,7 @@ public class Notification implements Parcelable outResultColor = new ColorStateList[1]; title = ensureColorSpanContrast(title, bgColor, outResultColor); } button.setTextViewText(R.id.action0, title); button.setTextViewText(R.id.action0, processTextSpans(title)); setTextViewColorPrimary(button, R.id.action0); if (outResultColor != null && outResultColor[0] != null) { // We need to set the text color as well since changing a text to uppercase Loading @@ -4683,7 +4698,8 @@ public class Notification implements Parcelable button.setTextColor(R.id.action0,resolveContrastColor()); } } else { button.setTextViewText(R.id.action0, processLegacyText(action.title)); button.setTextViewText(R.id.action0, processTextSpans( processLegacyText(action.title))); if (isColorized() && !ambient) { setTextViewColorPrimary(button, R.id.action0); } else if (mN.color != COLOR_DEFAULT && mTintActionButtons) { Loading Loading @@ -5682,7 +5698,8 @@ public class Notification implements Parcelable RemoteViews contentView = getStandardView(mBuilder.getBigPictureLayoutResource()); if (mSummaryTextSet) { contentView.setTextViewText(R.id.text, mBuilder.processLegacyText(mSummaryText)); contentView.setTextViewText(R.id.text, mBuilder.processTextSpans( mBuilder.processLegacyText(mSummaryText))); mBuilder.setTextViewColorSecondary(contentView, R.id.text); contentView.setViewVisibility(R.id.text, View.VISIBLE); } Loading Loading @@ -5864,7 +5881,7 @@ public class Notification implements Parcelable static void applyBigTextContentView(Builder builder, RemoteViews contentView, CharSequence bigTextText) { contentView.setTextViewText(R.id.big_text, bigTextText); contentView.setTextViewText(R.id.big_text, builder.processTextSpans(bigTextText)); builder.setTextViewColorSecondary(contentView, R.id.big_text); contentView.setViewVisibility(R.id.big_text, TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE); Loading Loading @@ -6199,7 +6216,8 @@ public class Notification implements Parcelable int rowId = rowIds[i]; contentView.setViewVisibility(rowId, View.VISIBLE); contentView.setTextViewText(rowId, makeMessageLine(m, mBuilder)); contentView.setTextViewText(rowId, mBuilder.processTextSpans( makeMessageLine(m, mBuilder))); mBuilder.setTextViewColorSecondary(contentView, rowId); if (contractedMessage == m) { Loading Loading @@ -6565,7 +6583,8 @@ public class Notification implements Parcelable CharSequence str = mTexts.get(i); if (!TextUtils.isEmpty(str)) { contentView.setViewVisibility(rowIds[i], View.VISIBLE); contentView.setTextViewText(rowIds[i], mBuilder.processLegacyText(str)); contentView.setTextViewText(rowIds[i], mBuilder.processTextSpans(mBuilder.processLegacyText(str))); mBuilder.setTextViewColorSecondary(contentView, rowIds[i]); contentView.setViewPadding(rowIds[i], 0, topPadding, 0, 0); handleInboxImageMargin(contentView, rowIds[i], first); Loading