Loading core/java/android/annotation/ColorInt.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; /** * Denotes that the annotated element represents a packed color * int, {@code AARRGGBB}. * int, {@code AARRGGBB}. If applied to an int array, every element * in the array represents a color integer. * <p> * public abstract void setTextColor(@ColorInt int color); * }</pre> Loading core/java/android/app/Notification.java +8 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.SdkConstant; Loading Loading @@ -338,6 +339,7 @@ public class Notification implements Parcelable * @see #FLAG_SHOW_LIGHTS * @see #flags */ @ColorInt public int ledARGB; /** Loading Loading @@ -520,12 +522,14 @@ public class Notification implements Parcelable * {@link #icon} image (stenciled in white) atop a field of this color. Alpha components are * ignored. */ @ColorInt public int color = COLOR_DEFAULT; /** * Special value of {@link #color} telling the system not to decorate this notification with * any special color but instead use default colors when presenting this notification. */ @ColorInt public static final int COLOR_DEFAULT = 0; // AKA Color.TRANSPARENT /** Loading Loading @@ -2388,7 +2392,7 @@ public class Notification implements Parcelable * @see Notification#ledOnMS * @see Notification#ledOffMS */ public Builder setLights(int argb, int onMs, int offMs) { public Builder setLights(@ColorInt int argb, int onMs, int offMs) { mLedArgb = argb; mLedOnMs = onMs; mLedOffMs = offMs; Loading Loading @@ -2712,7 +2716,7 @@ public class Notification implements Parcelable * * @return The same Builder. */ public Builder setColor(int argb) { public Builder setColor(@ColorInt int argb) { mColor = argb; return this; } Loading Loading @@ -5160,7 +5164,7 @@ public class Notification implements Parcelable * automotive setting. This method can be used to override the color provided in the * notification in such a situation. */ public CarExtender setColor(int color) { public CarExtender setColor(@ColorInt int color) { mColor = color; return this; } Loading @@ -5170,6 +5174,7 @@ public class Notification implements Parcelable * * @see setColor */ @ColorInt public int getColor() { return mColor; } Loading core/java/android/content/res/ColorStateList.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.res; import android.annotation.ColorInt; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.Resources.Theme; Loading Loading @@ -91,7 +92,7 @@ public class ColorStateList implements Parcelable { * Creates a ColorStateList that returns the specified mapping from * states to colors. */ public ColorStateList(int[][] states, int[] colors) { public ColorStateList(int[][] states, @ColorInt int[] colors) { mStateSpecs = states; mColors = colors; Loading @@ -102,7 +103,7 @@ public class ColorStateList implements Parcelable { * @return A ColorStateList containing a single color. */ @NonNull public static ColorStateList valueOf(int color) { public static ColorStateList valueOf(@ColorInt int color) { synchronized (sCache) { final int index = sCache.indexOfKey(color); if (index >= 0) { Loading Loading @@ -436,6 +437,7 @@ public class ColorStateList implements Parcelable { * * @return the default color in this {@link ColorStateList}. */ @ColorInt public int getDefaultColor() { return mDefaultColor; } Loading core/java/android/content/res/Resources.java +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.res; import android.annotation.ColorInt; import com.android.internal.util.XmlUtils; import org.xmlpull.v1.XmlPullParser; Loading Loading @@ -925,6 +926,7 @@ public class Resources { * @return A single color value in the form 0xAARRGGBB. * @deprecated Use {@link #getColor(int, Theme)} instead. */ @ColorInt public int getColor(@ColorRes int id) throws NotFoundException { return getColor(id, null); } Loading @@ -945,6 +947,7 @@ public class Resources { * * @return A single color value in the form 0xAARRGGBB. */ @ColorInt public int getColor(@ColorRes int id, @Nullable Theme theme) throws NotFoundException { TypedValue value; synchronized (mAccessLock) { Loading core/java/android/content/res/TypedArray.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.content.res; import android.annotation.AnyRes; import android.annotation.ColorInt; import android.annotation.Nullable; import android.graphics.drawable.Drawable; import android.os.StrictMode; Loading Loading @@ -420,7 +421,8 @@ public class TypedArray { * @throws UnsupportedOperationException if the attribute is defined but is * not an integer color or color state list. */ public int getColor(int index, int defValue) { @ColorInt public int getColor(int index, @ColorInt int defValue) { if (mRecycled) { throw new RuntimeException("Cannot make calls to a recycled instance!"); } Loading Loading
core/java/android/annotation/ColorInt.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; /** * Denotes that the annotated element represents a packed color * int, {@code AARRGGBB}. * int, {@code AARRGGBB}. If applied to an int array, every element * in the array represents a color integer. * <p> * public abstract void setTextColor(@ColorInt int color); * }</pre> Loading
core/java/android/app/Notification.java +8 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.SdkConstant; Loading Loading @@ -338,6 +339,7 @@ public class Notification implements Parcelable * @see #FLAG_SHOW_LIGHTS * @see #flags */ @ColorInt public int ledARGB; /** Loading Loading @@ -520,12 +522,14 @@ public class Notification implements Parcelable * {@link #icon} image (stenciled in white) atop a field of this color. Alpha components are * ignored. */ @ColorInt public int color = COLOR_DEFAULT; /** * Special value of {@link #color} telling the system not to decorate this notification with * any special color but instead use default colors when presenting this notification. */ @ColorInt public static final int COLOR_DEFAULT = 0; // AKA Color.TRANSPARENT /** Loading Loading @@ -2388,7 +2392,7 @@ public class Notification implements Parcelable * @see Notification#ledOnMS * @see Notification#ledOffMS */ public Builder setLights(int argb, int onMs, int offMs) { public Builder setLights(@ColorInt int argb, int onMs, int offMs) { mLedArgb = argb; mLedOnMs = onMs; mLedOffMs = offMs; Loading Loading @@ -2712,7 +2716,7 @@ public class Notification implements Parcelable * * @return The same Builder. */ public Builder setColor(int argb) { public Builder setColor(@ColorInt int argb) { mColor = argb; return this; } Loading Loading @@ -5160,7 +5164,7 @@ public class Notification implements Parcelable * automotive setting. This method can be used to override the color provided in the * notification in such a situation. */ public CarExtender setColor(int color) { public CarExtender setColor(@ColorInt int color) { mColor = color; return this; } Loading @@ -5170,6 +5174,7 @@ public class Notification implements Parcelable * * @see setColor */ @ColorInt public int getColor() { return mColor; } Loading
core/java/android/content/res/ColorStateList.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.res; import android.annotation.ColorInt; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.Resources.Theme; Loading Loading @@ -91,7 +92,7 @@ public class ColorStateList implements Parcelable { * Creates a ColorStateList that returns the specified mapping from * states to colors. */ public ColorStateList(int[][] states, int[] colors) { public ColorStateList(int[][] states, @ColorInt int[] colors) { mStateSpecs = states; mColors = colors; Loading @@ -102,7 +103,7 @@ public class ColorStateList implements Parcelable { * @return A ColorStateList containing a single color. */ @NonNull public static ColorStateList valueOf(int color) { public static ColorStateList valueOf(@ColorInt int color) { synchronized (sCache) { final int index = sCache.indexOfKey(color); if (index >= 0) { Loading Loading @@ -436,6 +437,7 @@ public class ColorStateList implements Parcelable { * * @return the default color in this {@link ColorStateList}. */ @ColorInt public int getDefaultColor() { return mDefaultColor; } Loading
core/java/android/content/res/Resources.java +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.res; import android.annotation.ColorInt; import com.android.internal.util.XmlUtils; import org.xmlpull.v1.XmlPullParser; Loading Loading @@ -925,6 +926,7 @@ public class Resources { * @return A single color value in the form 0xAARRGGBB. * @deprecated Use {@link #getColor(int, Theme)} instead. */ @ColorInt public int getColor(@ColorRes int id) throws NotFoundException { return getColor(id, null); } Loading @@ -945,6 +947,7 @@ public class Resources { * * @return A single color value in the form 0xAARRGGBB. */ @ColorInt public int getColor(@ColorRes int id, @Nullable Theme theme) throws NotFoundException { TypedValue value; synchronized (mAccessLock) { Loading
core/java/android/content/res/TypedArray.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.content.res; import android.annotation.AnyRes; import android.annotation.ColorInt; import android.annotation.Nullable; import android.graphics.drawable.Drawable; import android.os.StrictMode; Loading Loading @@ -420,7 +421,8 @@ public class TypedArray { * @throws UnsupportedOperationException if the attribute is defined but is * not an integer color or color state list. */ public int getColor(int index, int defValue) { @ColorInt public int getColor(int index, @ColorInt int defValue) { if (mRecycled) { throw new RuntimeException("Cannot make calls to a recycled instance!"); } Loading