summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Xiaowen Lei <xilei@google.com> 2025-02-11 13:20:34 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-11 13:20:34 -0800
commit957ded4114674b0e17b637fa1ce3e33a7635e4b7 (patch)
treec1c3e85134e5ed712e110271c90bb6e487f704d8
parent862604cac23c738330519d8e5cdbf67d6eb3a846 (diff)
parent7300e04f1c7733568c4018c20b5b5945b430a821 (diff)
Merge "Define FADED_OPACITY and used it in getFadedColor." into main
-rw-r--r--core/java/com/android/internal/widget/NotificationProgressBar.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/com/android/internal/widget/NotificationProgressBar.java b/core/java/com/android/internal/widget/NotificationProgressBar.java
index 905d4dd547f3..c0fe0d125e44 100644
--- a/core/java/com/android/internal/widget/NotificationProgressBar.java
+++ b/core/java/com/android/internal/widget/NotificationProgressBar.java
@@ -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();
@@ -851,12 +852,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));
@@ -1200,7 +1201,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