Show minimized header text with the correct text weight
Fixes: 184863420 Test: visual Change-Id: Ic16f9e88e118e7ea5fe14054cf1c35318d4a6ddd
This commit is contained in:
@@ -6053,11 +6053,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user