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

Commit 9c18d720 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Refactor right icon space calculation for promoted notifs

Promoted notifications don't show the expander, so we need to correctly
calculate the space needed on the right side both with and without a
large icon present.

This was already done, but it was a bit hacky and had a couple of bugs:
- the margin for the right icon itself was set to
  notification_content_margin (20dp) all the time if promoted, but this
  dimension is no longer used if notificationsRedesignTemplates is on -
  it should be notification_2025_margin (16dp) in that case
- the margin for the top line, that needs to be aligned to the right
  icon accordingly, was calculated using
  notification_content_margin_end (16dp), leading to an unintentional
  4dp offset
- mHeadingExtraMarginSet was used for this special top line margin; this
  is normally calculated in setRightIconState, and according to its
  javadoc it shouldn't include the 16dp margin; since this margin was
  needed for the promoted notifs, the "hack" was to re-calculate it
  AFTER setRightIconState to include the margin.

What this change does is:
- consistently use notification_content_margin/notification_2025_margin
  depending on the redesign flag state
- always calculate and apply the end margin for the right icon (in
  bindLargeIcon) when one of the flags is on (this will also be needed
  in a follow-up fix)
- use mHeadingFullMarginSet, since it already includes the margin we
  need, and remove the override to mHeadingExtraMarginSet

Bug: 407819104
Bug: 420643875
Bug: 403536710
Test: check that the margins of both promoted and regular notifications
are correct, both with and without a large icon
Flag: android.app.notifications_redesign_templates
Flag: android.app.ui_rich_ongoing

Change-Id: If7c65d83bbf3de7b1ee2ea0eb46a72b1d6c05e54
parent 65110ddf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment