Handle empty bigTexts more gracefully
We're now falling back to the normal text if the bigtext is empty Bug: 28318145 Change-Id: I5da237780407b62d21f79f7a754736ae1e4a8785
This commit is contained in:
@@ -4264,15 +4264,19 @@ public class Notification implements Parcelable
|
||||
public RemoteViews makeBigContentView() {
|
||||
|
||||
// Nasty
|
||||
CharSequence oldBuilderContentText =
|
||||
mBuilder.getAllExtras().getCharSequence(EXTRA_TEXT);
|
||||
CharSequence text = mBuilder.getAllExtras().getCharSequence(EXTRA_TEXT);
|
||||
mBuilder.getAllExtras().putCharSequence(EXTRA_TEXT, null);
|
||||
|
||||
RemoteViews contentView = getStandardView(mBuilder.getBigTextLayoutResource());
|
||||
|
||||
mBuilder.getAllExtras().putCharSequence(EXTRA_TEXT, oldBuilderContentText);
|
||||
mBuilder.getAllExtras().putCharSequence(EXTRA_TEXT, text);
|
||||
|
||||
CharSequence bigTextText = mBuilder.processLegacyText(mBigText);
|
||||
if (TextUtils.isEmpty(bigTextText)) {
|
||||
// In case the bigtext is null / empty fall back to the normal text to avoid a weird
|
||||
// experience
|
||||
bigTextText = mBuilder.processLegacyText(text);
|
||||
}
|
||||
contentView.setTextViewText(R.id.big_text, bigTextText);
|
||||
contentView.setViewVisibility(R.id.big_text,
|
||||
TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user