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

Commit 03d0d659 authored by Selim Cinek's avatar Selim Cinek
Browse files

Made the subtexts consistent among expanded / collapsed version

To ensure that the position of the expandbutton stays.

Change-Id: I02078fed1a2b31ff6e3b0f9b2db3c4e2844acd09
parent 9d9fc6e9
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
@@ -3135,7 +3135,7 @@ public class Notification implements Parcelable
        private void bindNotificationHeader(RemoteViews contentView) {
            bindSmallIcon(contentView);
            bindHeaderAppName(contentView);
            bindHeaderSubText(contentView, mN.extras.getCharSequence(EXTRA_SUB_TEXT));
            bindHeaderSubText(contentView);
            bindHeaderChronometerAndTime(contentView);
            bindExpandButton(contentView);
        }
@@ -3160,7 +3160,12 @@ public class Notification implements Parcelable
            }
        }

        private void bindHeaderSubText(RemoteViews contentView, CharSequence subText) {
        private void bindHeaderSubText(RemoteViews contentView) {
            CharSequence subText = mN.extras.getCharSequence(EXTRA_SUB_TEXT);
            if (subText == null && mStyle != null && mStyle.mSummaryTextSet
                    && mStyle.hasSummaryInHeader()) {
                subText = mStyle.mSummaryText;
            }
            if (subText != null) {
                // TODO: Remove the span entirely to only have the string with propper formating.
                contentView.setTextViewText(R.id.header_sub_text, processLegacyText(subText));
@@ -3593,12 +3598,6 @@ public class Notification implements Parcelable
                contentView.setViewVisibility(R.id.line1, View.VISIBLE);
            }

            final CharSequence overflowText = mSummaryTextSet ? mSummaryText : null;
            final CharSequence subText = mBuilder.mN.extras.getCharSequence(EXTRA_SUB_TEXT);
            if (overflowText != null && !overflowText.equals(subText)) {
                mBuilder.bindHeaderSubText(contentView, overflowText);
            }

            // Clear text in case we use the line to show the profile badge.
            contentView.setTextViewText(com.android.internal.R.id.text, "");
            contentView.setViewVisibility(com.android.internal.R.id.line3, View.GONE);
@@ -3692,6 +3691,14 @@ public class Notification implements Parcelable
        protected boolean hasProgress() {
            return true;
        }

        /**
         * @hide
         * @return Whether we should put the summary be put into the notification header
         */
        public boolean hasSummaryInHeader() {
            return true;
        }
    }

    /**
@@ -3799,7 +3806,10 @@ public class Notification implements Parcelable
            }

            RemoteViews contentView = getStandardView(mBuilder.getBigPictureLayoutResource());

            if (mSummaryTextSet) {
                contentView.setTextViewText(R.id.text, mBuilder.processLegacyText(mSummaryText));
                contentView.setViewVisibility(R.id.line3, View.VISIBLE);
            }
            if (mBigLargeIconSet) {
                mBuilder.mN.mLargeIcon = oldLargeIcon;
            }
@@ -3838,6 +3848,14 @@ public class Notification implements Parcelable
            }
            mPicture = extras.getParcelable(EXTRA_PICTURE);
        }

        /**
         * @hide
         */
        @Override
        public boolean hasSummaryInHeader() {
            return false;
        }
    }

    /**