Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7599878c authored by Selim Cinek's avatar Selim Cinek
Browse files

Handle empty bigTexts more gracefully

We're now falling back to the normal text if the bigtext is empty

Bug: 28318145
Change-Id: I5da237780407b62d21f79f7a754736ae1e4a8785
parent 31d37b91
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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);