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

Commit a46a4036 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge "Handle empty bigTexts more gracefully" into nyc-dev

am: 1689203d

* commit '1689203d':
  Handle empty bigTexts more gracefully

Change-Id: I2ddfd7978b500237e2fe0a213add3a70ebada470
parents 4b86c078 1689203d
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -4268,15 +4268,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);