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

Commit 7300e04f authored by Xiaowen Lei's avatar Xiaowen Lei
Browse files

Define FADED_OPACITY and used it in getFadedColor.

Flag: android.app.api_rich_ongoing
Bug: 390203374
Test: No behavior changes in unit test, screenshot test, and test notifications.
Change-Id: Iea4c580437079e8d5d49e86e585fb5a37c44a71f
parent 75fa55d8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public final class NotificationProgressBar extends ProgressBar implements
        NotificationProgressDrawable.BoundsChangeListener {
    private static final String TAG = "NotificationProgressBar";
    private static final boolean DEBUG = false;
    private static final float FADED_OPACITY = 0.5f;

    private NotificationProgressDrawable mNotificationProgressDrawable;
    private final Rect mProgressDrawableBounds = new Rect();
@@ -830,12 +831,12 @@ public final class NotificationProgressBar extends ProgressBar implements
    }

    /**
     * Get a color with an opacity that's 50% of the input color.
     * Get a color that's the input color with opacity updated to FADED_OPACITY.
     */
    @ColorInt
    static int getFadedColor(@ColorInt int color) {
        return Color.argb(
                (int) (Color.alpha(color) * 0.5f + 0.5f),
                (int) (Color.alpha(color) * FADED_OPACITY + 0.5f),
                Color.red(color),
                Color.green(color),
                Color.blue(color));
@@ -1193,7 +1194,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 50%.
         *       1. The drawing color is mColor with opacity updated to FADED_OPACITY.
         *       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