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

Commit c75d890f authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge changes I851af077,I9d1386d9 into main

* changes:
  [RONs] do not apply marginEnd to title in TopLineView
  Add null check to NotificationToplineView
parents dcee476e 998782ba
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -384,6 +384,13 @@ public class NotificationTopLineView extends ViewGroup {
        return false;
    }

    /**
     * Returns whether the title is present.
     */
    public boolean isTitlePresent() {
        return mTitle != null;
    }

    /**
     * Determine if the given point is touching an active part of the top line.
     */
+16 −2
Original line number Diff line number Diff line
@@ -211,14 +211,28 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
            rightIconLP.setMarginEnd(horizontalMargin);
            mRightIcon.setLayoutParams(rightIconLP);

            // if there is no title and topline view, there is nothing to adjust.
            if (mNotificationTopLine == null && mTitle == null) {
                return;
            }

            // align top line view to start of the right icon.
            final int iconSize = mView.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_right_icon_size);
            final int marginEnd = 2 * horizontalMargin + iconSize;
            final boolean isTitleInTopLine;
            // set margin end for the top line view if it exists
            if (mNotificationTopLine != null) {
                mNotificationTopLine.setHeaderTextMarginEnd(marginEnd);
                isTitleInTopLine = mNotificationTopLine.isTitlePresent();
            } else {
                isTitleInTopLine = false;
            }

            // Margin is to be applied to the title only when it is in the body,
            // but not in the title.
            // title has too much margin on the right, so we need to reduce it
            if (mTitle != null) {
            if (!isTitleInTopLine && mTitle != null) {
                final ViewGroup.MarginLayoutParams titleLP =
                    (ViewGroup.MarginLayoutParams) mTitle.getLayoutParams();
                titleLP.setMarginEnd(marginEnd);