Loading core/java/android/app/Notification.java +3 −1 Original line number Diff line number Diff line Loading @@ -6048,11 +6048,13 @@ public class Notification implements Parcelable .viewType(StandardTemplateParams.VIEW_TYPE_MINIMIZED) .highlightExpander(false) .fillTextsFrom(this); if (!useRegularSubtext || TextUtils.isEmpty(mParams.summaryText)) { if (!useRegularSubtext || TextUtils.isEmpty(p.summaryText)) { p.summaryText(createSummaryText()); } RemoteViews header = makeNotificationHeader(p); header.setBoolean(R.id.notification_header, "setAcceptAllTouches", true); // The low priority header has no app name and shows the text header.setBoolean(R.id.notification_header, "styleTextAsTitle", true); return header; } Loading core/java/android/view/NotificationHeaderView.java +23 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.Build; import android.util.AttributeSet; import android.widget.RelativeLayout; import android.widget.RemoteViews; import android.widget.TextView; import com.android.internal.R; import com.android.internal.widget.CachingIconView; Loading Loading @@ -174,6 +175,28 @@ public class NotificationHeaderView extends RelativeLayout { (int) (extraMarginEndDp * getResources().getDisplayMetrics().density)); } /** * This is used to make the low-priority header show the bolded text of a title. * * @param styleTextAsTitle true if this header's text is to have the style of a title */ @RemotableViewMethod public void styleTextAsTitle(boolean styleTextAsTitle) { int styleResId = styleTextAsTitle ? R.style.TextAppearance_DeviceDefault_Notification_Title : R.style.TextAppearance_DeviceDefault_Notification_Info; // Most of the time, we're showing text in the minimized state View headerText = findViewById(R.id.header_text); if (headerText instanceof TextView) { ((TextView) headerText).setTextAppearance(styleResId); } // If there's no summary or text, we show the app name instead of nothing View appNameText = findViewById(R.id.app_name_text); if (appNameText instanceof TextView) { ((TextView) appNameText).setTextAppearance(styleResId); } } /** * Get the current margin end value for the header text. * Add this to {@link #getTopLineBaseMarginEnd()} to get the total margin of the top line. Loading Loading
core/java/android/app/Notification.java +3 −1 Original line number Diff line number Diff line Loading @@ -6048,11 +6048,13 @@ public class Notification implements Parcelable .viewType(StandardTemplateParams.VIEW_TYPE_MINIMIZED) .highlightExpander(false) .fillTextsFrom(this); if (!useRegularSubtext || TextUtils.isEmpty(mParams.summaryText)) { if (!useRegularSubtext || TextUtils.isEmpty(p.summaryText)) { p.summaryText(createSummaryText()); } RemoteViews header = makeNotificationHeader(p); header.setBoolean(R.id.notification_header, "setAcceptAllTouches", true); // The low priority header has no app name and shows the text header.setBoolean(R.id.notification_header, "styleTextAsTitle", true); return header; } Loading
core/java/android/view/NotificationHeaderView.java +23 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.Build; import android.util.AttributeSet; import android.widget.RelativeLayout; import android.widget.RemoteViews; import android.widget.TextView; import com.android.internal.R; import com.android.internal.widget.CachingIconView; Loading Loading @@ -174,6 +175,28 @@ public class NotificationHeaderView extends RelativeLayout { (int) (extraMarginEndDp * getResources().getDisplayMetrics().density)); } /** * This is used to make the low-priority header show the bolded text of a title. * * @param styleTextAsTitle true if this header's text is to have the style of a title */ @RemotableViewMethod public void styleTextAsTitle(boolean styleTextAsTitle) { int styleResId = styleTextAsTitle ? R.style.TextAppearance_DeviceDefault_Notification_Title : R.style.TextAppearance_DeviceDefault_Notification_Info; // Most of the time, we're showing text in the minimized state View headerText = findViewById(R.id.header_text); if (headerText instanceof TextView) { ((TextView) headerText).setTextAppearance(styleResId); } // If there's no summary or text, we show the app name instead of nothing View appNameText = findViewById(R.id.app_name_text); if (appNameText instanceof TextView) { ((TextView) appNameText).setTextAppearance(styleResId); } } /** * Get the current margin end value for the header text. * Add this to {@link #getTopLineBaseMarginEnd()} to get the total margin of the top line. Loading