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

Commit 5dbb9ff6 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Fix bad one-line MessagingStyle" into nyc-dev

parents 2c69d1ec b1f427c7
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -4323,18 +4323,23 @@ public class Notification implements Parcelable
                // experience
                bigTextText = mBuilder.processLegacyText(text);
            }
            applyBigTextContentView(mBuilder, contentView, bigTextText);

            return contentView;
        }

        static void applyBigTextContentView(Builder builder,
                RemoteViews contentView, CharSequence bigTextText) {
            contentView.setTextViewText(R.id.big_text, bigTextText);
            contentView.setViewVisibility(R.id.big_text,
                    TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE);
            contentView.setInt(R.id.big_text, "setMaxLines", calculateMaxLines());
            contentView.setBoolean(R.id.big_text, "setHasImage", mBuilder.mN.mLargeIcon != null);

            return contentView;
            contentView.setInt(R.id.big_text, "setMaxLines", calculateMaxLines(builder));
            contentView.setBoolean(R.id.big_text, "setHasImage", builder.mN.mLargeIcon != null);
        }

        private int calculateMaxLines() {
        private static int calculateMaxLines(Builder builder) {
            int lineCount = MAX_LINES;
            boolean hasActions = mBuilder.mActions.size() > 0;
            boolean hasActions = builder.mActions.size() > 0;
            if (hasActions) {
                lineCount -= LINES_CONSUMED_BY_ACTIONS;
            }
@@ -4532,6 +4537,16 @@ public class Notification implements Parcelable
                    : mConversationTitle;
            boolean hasTitle = !TextUtils.isEmpty(title);

            if (!hasTitle && mMessages.size() == 1) {
                CharSequence sender = mMessages.get(0).mSender;
                CharSequence text = mMessages.get(0).mText;
                RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
                        mBuilder.getBigTextLayoutResource(),
                        false /* progress */, sender, null /* text */);
                BigTextStyle.applyBigTextContentView(mBuilder, contentView, text);
                return contentView;
            }

            RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
                    mBuilder.getMessagingLayoutResource(),
                    false /* hasProgress */,