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

Commit 22a05fa1 authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Update future progress opacity per latest UX spec.

Flag: android.app.api_rich_ongoing
Bug: 390203374
Test: patch ag/30006048 and run ProgressStyleNotificationScreenshotTest on device
Test: NotificationProgressBarTest
Change-Id: I9ee8499dbf122734b436d65623809c272d964028
parent 74714d5c
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -830,12 +830,12 @@ public final class NotificationProgressBar extends ProgressBar implements
    }
    }


    /**
    /**
     * Get a color with an opacity that's 40% of the input color.
     * Get a color with an opacity that's 50% of the input color.
     */
     */
    @ColorInt
    @ColorInt
    static int getFadedColor(@ColorInt int color) {
    static int getFadedColor(@ColorInt int color) {
        return Color.argb(
        return Color.argb(
                (int) (Color.alpha(color) * 0.4f + 0.5f),
                (int) (Color.alpha(color) * 0.5f + 0.5f),
                Color.red(color),
                Color.red(color),
                Color.green(color),
                Color.green(color),
                Color.blue(color));
                Color.blue(color));
@@ -1193,7 +1193,7 @@ public final class NotificationProgressBar extends ProgressBar implements
         * <p>
         * <p>
         * <pre>
         * <pre>
         *     When mFaded is set to true, a combination of the following is done to the segment:
         *     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 40%.
         *       1. The drawing color is mColor with opacity updated to 50%.
         *       2. The gap between faded and non-faded segments is:
         *       2. The gap between faded and non-faded segments is:
         *          - the segment-segment gap, when there is no tracker icon
         *          - the segment-segment gap, when there is no tracker icon
         *          - 0, when there is tracker icon
         *          - 0, when there is tracker icon
+25 −25
Original line number Original line Diff line number Diff line
@@ -143,8 +143,8 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedRed = 0x66FF0000;
        int fadedRed = 0x80FF0000;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 300, fadedRed, true)));
                List.of(new DrawableSegment(0, 300, fadedRed, true)));


@@ -271,8 +271,8 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedBlue = 0x660000FF;
        int fadedBlue = 0x800000FF;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 180, Color.BLUE),
                List.of(new DrawableSegment(0, 180, Color.BLUE),
                        new DrawableSegment(180, 300, fadedBlue, true)));
                        new DrawableSegment(180, 300, fadedBlue, true)));
@@ -321,8 +321,8 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedGreen = 0x6600FF00;
        int fadedGreen = 0x8000FF00;
        expectedDrawableParts = new ArrayList<>(List.of(new DrawableSegment(0, 146, Color.RED),
        expectedDrawableParts = new ArrayList<>(List.of(new DrawableSegment(0, 146, Color.RED),
                new DrawableSegment(150, 180, Color.GREEN),
                new DrawableSegment(150, 180, Color.GREEN),
                new DrawableSegment(180, 300, fadedGreen, true)));
                new DrawableSegment(180, 300, fadedGreen, true)));
@@ -370,8 +370,8 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedGreen = 0x6600FF00;
        int fadedGreen = 0x8000FF00;
        expectedDrawableParts = new ArrayList<>(List.of(new DrawableSegment(0, 146, Color.RED),
        expectedDrawableParts = new ArrayList<>(List.of(new DrawableSegment(0, 146, Color.RED),
                new DrawableSegment(150, 176, Color.GREEN),
                new DrawableSegment(150, 176, Color.GREEN),
                new DrawableSegment(180, 300, fadedGreen, true)));
                new DrawableSegment(180, 300, fadedGreen, true)));
@@ -439,9 +439,9 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedBlue = 0x660000FF;
        int fadedBlue = 0x800000FF;
        int fadedYellow = 0x66FFFF00;
        int fadedYellow = 0x80FFFF00;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 34.219177F, Color.BLUE),
                List.of(new DrawableSegment(0, 34.219177F, Color.BLUE),
                        new DrawablePoint(38.219177F, 50.219177F, Color.RED),
                        new DrawablePoint(38.219177F, 50.219177F, Color.RED),
@@ -517,9 +517,9 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedGreen = 0x6600FF00;
        int fadedGreen = 0x8000FF00;
        int fadedYellow = 0x66FFFF00;
        int fadedYellow = 0x80FFFF00;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 34.095238F, Color.RED),
                List.of(new DrawableSegment(0, 34.095238F, Color.RED),
                        new DrawablePoint(38.095238F, 50.095238F, Color.RED),
                        new DrawablePoint(38.095238F, 50.095238F, Color.RED),
@@ -594,9 +594,9 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedGreen = 0x6600FF00;
        int fadedGreen = 0x8000FF00;
        int fadedYellow = 0x66FFFF00;
        int fadedYellow = 0x80FFFF00;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawablePoint(0, 12, Color.RED),
                List.of(new DrawablePoint(0, 12, Color.RED),
                        new DrawableSegment(16, 65, Color.RED),
                        new DrawableSegment(16, 65, Color.RED),
@@ -675,9 +675,9 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedGreen = 0x6600FF00;
        int fadedGreen = 0x8000FF00;
        int fadedYellow = 0x66FFFF00;
        int fadedYellow = 0x80FFFF00;
        expectedDrawableParts = new ArrayList<>(
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 16, Color.RED),
                List.of(new DrawableSegment(0, 16, Color.RED),
                        new DrawablePoint(20, 32, Color.RED),
                        new DrawablePoint(20, 32, Color.RED),
@@ -1039,9 +1039,9 @@ public class NotificationProgressBarTest {
                        isStyledByProgress
                        isStyledByProgress
                );
                );


        // Colors with 40% opacity
        // Colors with 50% opacity
        int fadedBlue = 0x660000FF;
        int fadedBlue = 0x800000FF;
        int fadedYellow = 0x66FFFF00;
        int fadedYellow = 0x80FFFF00;
        List<DrawablePart> expectedDrawableParts = new ArrayList<>(
        List<DrawablePart> expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 34.219177F, Color.BLUE),
                List.of(new DrawableSegment(0, 34.219177F, Color.BLUE),
                        new DrawablePoint(38.219177F, 50.219177F, Color.RED),
                        new DrawablePoint(38.219177F, 50.219177F, Color.RED),
@@ -1089,8 +1089,8 @@ public class NotificationProgressBarTest {
                        isStyledByProgress
                        isStyledByProgress
                );
                );


        // Colors with 40% opacity
        // Colors with 50%f opacity
        int fadedBlue = 0x660000FF;
        int fadedBlue = 0x800000FF;
        List<DrawablePart> expectedDrawableParts = new ArrayList<>(
        List<DrawablePart> expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 60.000004F, Color.BLUE),
                List.of(new DrawableSegment(0, 60.000004F, Color.BLUE),
                        new DrawableSegment(60.000004F, 100, fadedBlue, true)));
                        new DrawableSegment(60.000004F, 100, fadedBlue, true)));