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

Commit 4cb276b1 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Remove start margin from first child in top line

Bug: 417196998
Test: manual
Flag: android.app.notification_top_line_margin_fix
Change-Id: I0fd852f8dcdb0778a6b6acadc239a37404b98b76
parent f7b7eba5
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -34,6 +34,16 @@ flag {
  is_fixed_read_only: true
}

flag {
    name: "notification_top_line_margin_fix"
    namespace: "systemui"
    description: "Fixes a small bug where the timestamp had an unnecessary margin in grouped notifications."
    bug: "417196998"
    metadata {
       purpose: PURPOSE_BUGFIX
    }
}

flag {
  name: "api_metric_style"
  is_exported: true
+9 −1
Original line number Diff line number Diff line
@@ -183,11 +183,13 @@ public class NotificationTopLineView extends ViewGroup {
        // Only used when mGravityY is CENTER_VERTICAL
        int baselineY = mPaddingTop + ((childSpace - (mMaxAscent + mMaxDescent)) / 2) + mMaxAscent;

        boolean isFirstVisibleChild = true;
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
            if (child.getVisibility() == GONE) {
                continue;
            }

            int childHeight = child.getMeasuredHeight();
            MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();

@@ -228,13 +230,19 @@ public class NotificationTopLineView extends ViewGroup {
            if (mViewsToDisappear.contains(child)) {
                child.layout(start, childTop, start, childTop + childHeight);
            } else {
                // If this is the first child, don't include the start margin. The children will
                // generally have a 2dp start margin by default to space them out, but if the child
                // is first we don't need that.
                if (!android.app.Flags.notificationTopLineMarginFix() || !isFirstVisibleChild) {
                    start += params.getMarginStart();
                }
                int end = start + child.getMeasuredWidth();
                int layoutLeft = isRtl ? width - end : start;
                int layoutRight = isRtl ? width - start : end;
                start = end + params.getMarginEnd();
                child.layout(layoutLeft, childTop, layoutRight, childTop + childHeight);
            }
            isFirstVisibleChild = false;
        }
        updateTouchListener();
    }