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

Commit d0c0492e authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Consistent gap throughout and increased opacity after progress.

Flag: android.app.api_rich_ongoing
Fix: 383562384
Fix: 383557351
Test: Post ProgressStyle notifs via test app
Test: patch ag/30006048 and run ProgressStyleNotificationScreenshotTest
Change-Id: I048d0eb8770a1e13c3552d7effaa61d09b567d70
parent 69034085
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -147,11 +147,6 @@ public final class NotificationProgressDrawable extends Drawable {
            final Part prevPart = iPart == 0 ? null : mParts.get(iPart - 1);
            final Part nextPart = iPart + 1 == numParts ? null : mParts.get(iPart + 1);
            if (part instanceof Segment segment) {
                // Update the segment-point gap to 2X upon seeing the first faded segment.
                // (Assuming that all segments before are solid, and all segments after are faded.)
                if (segment.mFaded) {
                    segPointGap = mState.mSegPointGap * 2;
                }
                final float segWidth = segment.mFraction * totalWidth;
                // Advance the start position to account for a point immediately prior.
                final float startOffset = getSegStartOffset(prevPart, pointRadius, segPointGap, x);
@@ -225,7 +220,7 @@ public final class NotificationProgressDrawable extends Drawable {
        if (nextPart instanceof Segment nextSeg) {
            if (!seg.mFaded && nextSeg.mFaded) {
                // @see Segment#mFaded
                return hasTrackerIcon ? 0F : segSegGap * 4F;
                return hasTrackerIcon ? 0F : segSegGap;
            }
            return segSegGap;
        }
@@ -487,11 +482,10 @@ public final class NotificationProgressDrawable extends Drawable {
         * <p>
         *     <pre>
         *     When mFaded is set to true, a combination of the following is done to the segment:
         *       1. The drawing color is mColor with opacity updated to 15%.
         *       2. The segment-point gap is 2X the segment-point gap for non-faded segments.
         *       3. The gap between faded and non-faded segments is:
         *          4X the segment-segment gap, when there is no tracker icon
         *          0, when there is tracker icon
         *       1. The drawing color is mColor with opacity updated to 40%.
         *       2. The gap between faded and non-faded segments is:
         *          - the segment-segment gap, when there is no tracker icon
         *          - 0, when there is tracker icon
         *     </pre>
         * </p>
         */
@@ -764,7 +758,7 @@ public final class NotificationProgressDrawable extends Drawable {
    @ColorInt
    static int getFadedColor(@ColorInt int color) {
        return Color.argb(
                (int) (Color.alpha(color) * 0.25f + 0.5f),
                (int) (Color.alpha(color) * 0.4f + 0.5f),
                Color.red(color),
                Color.green(color),
                Color.blue(color));
+2 −2
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@
    <dimen name="notification_progress_margin_top">8dp</dimen>

    <!-- The horizontal margin before and after the notification progress bar. -->
    <dimen name="notification_progress_margin_horizontal">2dp</dimen>
    <dimen name="notification_progress_margin_horizontal">4dp</dimen>

    <!-- height of the notification header -->
    <dimen name="notification_header_height">56dp</dimen>
@@ -861,7 +861,7 @@
    <!-- The size of the progress tracker height -->
    <dimen name="notification_progress_tracker_height">20dp</dimen>
    <!-- The gap between segments in the notification progress bar -->
    <dimen name="notification_progress_segSeg_gap">2dp</dimen>
    <dimen name="notification_progress_segSeg_gap">4dp</dimen>
    <!-- The gap between a segment and a point in the notification progress bar -->
    <dimen name="notification_progress_segPoint_gap">4dp</dimen>
    <!-- The height of the notification progress bar segments -->