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

Commit af1d9c63 authored by Xiaowen Lei's avatar Xiaowen Lei Committed by Android (Google) Code Review
Browse files

Merge "Update future progress opacity per latest UX spec." into main

parents 90bad16d 22a05fa1
Loading
Loading
Loading
Loading
+3 −3
Original line number 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
    static int getFadedColor(@ColorInt int color) {
        return Color.argb(
                (int) (Color.alpha(color) * 0.4f + 0.5f),
                (int) (Color.alpha(color) * 0.5f + 0.5f),
                Color.red(color),
                Color.green(color),
                Color.blue(color));
@@ -1193,7 +1193,7 @@ public final class NotificationProgressBar extends ProgressBar implements
         * <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 40%.
         *       1. The drawing color is mColor with opacity updated to 50%.
         *       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
+25 −25
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ public class NotificationProgressBarTest {
                parts, drawableParts, segmentMinWidth, pointRadius, (float) progress / progressMax,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);

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

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

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

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

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

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

        // Colors with 40% opacity
        int fadedGreen = 0x6600FF00;
        int fadedYellow = 0x66FFFF00;
        // Colors with 50% opacity
        int fadedGreen = 0x8000FF00;
        int fadedYellow = 0x80FFFF00;
        expectedDrawableParts = new ArrayList<>(
                List.of(new DrawableSegment(0, 34.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,
                300, isStyledByProgress, hasTrackerIcon ? 0 : segSegGap);

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

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

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

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