summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2015-03-02 09:39:27 -0800
committerTor Norbye <tnorbye@google.com>2015-03-05 16:34:12 -0800
commit80756e38882720860db52f1fcc21fa1505a02abf (patch)
tree284afea0646c9e16b8f0a5ea11e013e21768e813 /core/java/android
parentcb59f2afb7a403af7c2bb6a6deb2c981a156fb96 (diff)
downloadframeworks_base-80756e38882720860db52f1fcc21fa1505a02abf.zip
frameworks_base-80756e38882720860db52f1fcc21fa1505a02abf.tar.gz
frameworks_base-80756e38882720860db52f1fcc21fa1505a02abf.tar.bz2
Annotate ARGB integer parameters with @ColorInt
Change-Id: I307f72a382272cf18ddb6b07d9fcb81228568d9a
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/annotation/ColorInt.java3
-rw-r--r--core/java/android/app/Notification.java11
-rw-r--r--core/java/android/content/res/ColorStateList.java6
-rw-r--r--core/java/android/content/res/Resources.java3
-rw-r--r--core/java/android/content/res/TypedArray.java4
-rw-r--r--core/java/android/gesture/GestureOverlayView.java7
-rw-r--r--core/java/android/text/TextPaint.java4
-rw-r--r--core/java/android/text/style/ForegroundColorSpan.java4
-rw-r--r--core/java/android/text/style/QuoteSpan.java4
-rw-r--r--core/java/android/view/View.java8
-rw-r--r--core/java/android/view/Window.java9
-rw-r--r--core/java/android/view/animation/Animation.java4
-rw-r--r--core/java/android/widget/AbsListView.java4
-rw-r--r--core/java/android/widget/CalendarView.java16
-rw-r--r--core/java/android/widget/EdgeEffect.java4
-rw-r--r--core/java/android/widget/RemoteViews.java3
-rw-r--r--core/java/android/widget/TextView.java13
-rw-r--r--core/java/android/widget/Toolbar.java5
18 files changed, 81 insertions, 31 deletions
diff --git a/core/java/android/annotation/ColorInt.java b/core/java/android/annotation/ColorInt.java
index 762a353..c4c93ee 100644
--- a/core/java/android/annotation/ColorInt.java
+++ b/core/java/android/annotation/ColorInt.java
@@ -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(&#64;ColorInt int color);
* }</pre>
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 9c00e1c..593585f 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -16,6 +16,7 @@
package android.app;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.IntDef;
import android.annotation.SdkConstant;
@@ -338,6 +339,7 @@ public class Notification implements Parcelable
* @see #FLAG_SHOW_LIGHTS
* @see #flags
*/
+ @ColorInt
public int ledARGB;
/**
@@ -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
/**
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -5170,6 +5174,7 @@ public class Notification implements Parcelable
*
* @see setColor
*/
+ @ColorInt
public int getColor() {
return mColor;
}
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java
index ace402a..841b09d 100644
--- a/core/java/android/content/res/ColorStateList.java
+++ b/core/java/android/content/res/ColorStateList.java
@@ -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;
@@ -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;
@@ -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) {
@@ -436,6 +437,7 @@ public class ColorStateList implements Parcelable {
*
* @return the default color in this {@link ColorStateList}.
*/
+ @ColorInt
public int getDefaultColor() {
return mDefaultColor;
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 584f3f6..5dc9ef9 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -16,6 +16,7 @@
package android.content.res;
+import android.annotation.ColorInt;
import com.android.internal.util.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
@@ -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);
}
@@ -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) {
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 3e07f0c..410849a 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -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;
@@ -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!");
}
diff --git a/core/java/android/gesture/GestureOverlayView.java b/core/java/android/gesture/GestureOverlayView.java
index e1a2a25..e0d454c 100644
--- a/core/java/android/gesture/GestureOverlayView.java
+++ b/core/java/android/gesture/GestureOverlayView.java
@@ -16,6 +16,7 @@
package android.gesture;
+import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -204,18 +205,20 @@ public class GestureOverlayView extends FrameLayout {
mOrientation = orientation;
}
- public void setGestureColor(int color) {
+ public void setGestureColor(@ColorInt int color) {
mCertainGestureColor = color;
}
- public void setUncertainGestureColor(int color) {
+ public void setUncertainGestureColor(@ColorInt int color) {
mUncertainGestureColor = color;
}
+ @ColorInt
public int getUncertainGestureColor() {
return mUncertainGestureColor;
}
+ @ColorInt
public int getGestureColor() {
return mCertainGestureColor;
}
diff --git a/core/java/android/text/TextPaint.java b/core/java/android/text/TextPaint.java
index 0447117..4f8cff0 100644
--- a/core/java/android/text/TextPaint.java
+++ b/core/java/android/text/TextPaint.java
@@ -16,6 +16,7 @@
package android.text;
+import android.annotation.ColorInt;
import android.graphics.Paint;
/**
@@ -25,8 +26,10 @@ import android.graphics.Paint;
public class TextPaint extends Paint {
// Special value 0 means no background paint
+ @ColorInt
public int bgColor;
public int baselineShift;
+ @ColorInt
public int linkColor;
public int[] drawableState;
public float density = 1.0f;
@@ -34,6 +37,7 @@ public class TextPaint extends Paint {
* Special value 0 means no custom underline
* @hide
*/
+ @ColorInt
public int underlineColor = 0;
/**
* Defined as a multiplier of the default underline thickness. Use 1.0f for default thickness.
diff --git a/core/java/android/text/style/ForegroundColorSpan.java b/core/java/android/text/style/ForegroundColorSpan.java
index c9e09bd..f167aab 100644
--- a/core/java/android/text/style/ForegroundColorSpan.java
+++ b/core/java/android/text/style/ForegroundColorSpan.java
@@ -16,6 +16,7 @@
package android.text.style;
+import android.annotation.ColorInt;
import android.os.Parcel;
import android.text.ParcelableSpan;
import android.text.TextPaint;
@@ -26,7 +27,7 @@ public class ForegroundColorSpan extends CharacterStyle
private final int mColor;
- public ForegroundColorSpan(int color) {
+ public ForegroundColorSpan(@ColorInt int color) {
mColor = color;
}
@@ -46,6 +47,7 @@ public class ForegroundColorSpan extends CharacterStyle
dest.writeInt(mColor);
}
+ @ColorInt
public int getForegroundColor() {
return mColor;
}
diff --git a/core/java/android/text/style/QuoteSpan.java b/core/java/android/text/style/QuoteSpan.java
index 29dd273..17748ca 100644
--- a/core/java/android/text/style/QuoteSpan.java
+++ b/core/java/android/text/style/QuoteSpan.java
@@ -16,6 +16,7 @@
package android.text.style;
+import android.annotation.ColorInt;
import android.graphics.Paint;
import android.graphics.Canvas;
import android.os.Parcel;
@@ -34,7 +35,7 @@ public class QuoteSpan implements LeadingMarginSpan, ParcelableSpan {
mColor = 0xff0000ff;
}
- public QuoteSpan(int color) {
+ public QuoteSpan(@ColorInt int color) {
super();
mColor = color;
}
@@ -55,6 +56,7 @@ public class QuoteSpan implements LeadingMarginSpan, ParcelableSpan {
dest.writeInt(mColor);
}
+ @ColorInt
public int getColor() {
return mColor;
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f25b640..ed15cc9 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -18,6 +18,7 @@ package android.view;
import android.animation.AnimatorInflater;
import android.animation.StateListAnimator;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
import android.annotation.IntDef;
@@ -14311,7 +14312,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #buildDrawingCache()
* @see #getDrawingCache()
*/
- public void setDrawingCacheBackgroundColor(int color) {
+ public void setDrawingCacheBackgroundColor(@ColorInt int color) {
if (color != mDrawingCacheBackgroundColor) {
mDrawingCacheBackgroundColor = color;
mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID;
@@ -14323,6 +14324,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @return The background color to used for the drawing cache's bitmap
*/
+ @ColorInt
public int getDrawingCacheBackgroundColor() {
return mDrawingCacheBackgroundColor;
}
@@ -15536,6 +15538,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return The known solid color background for this view, or 0 if the color may vary
*/
@ViewDebug.ExportedProperty(category = "drawing")
+ @ColorInt
public int getSolidColor() {
return 0;
}
@@ -16222,7 +16225,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @param color the color of the background
*/
@RemotableViewMethod
- public void setBackgroundColor(int color) {
+ public void setBackgroundColor(@ColorInt int color) {
if (mBackground instanceof ColorDrawable) {
((ColorDrawable) mBackground.mutate()).setColor(color);
computeOpaqueFlags();
@@ -16238,6 +16241,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @return The color of the ColorDrawable background, if set, otherwise 0.
*/
+ @ColorInt
public int getBackgroundColor() {
if (mBackground instanceof ColorDrawable) {
return ((ColorDrawable) mBackground).getColor();
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index e332135..744f665 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -16,6 +16,7 @@
package android.view;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
@@ -1069,7 +1070,7 @@ public abstract class Window {
public abstract void setTitle(CharSequence title);
@Deprecated
- public abstract void setTitleColor(int textColor);
+ public abstract void setTitleColor(@ColorInt int textColor);
public abstract void openPanel(int featureId, KeyEvent event);
@@ -1835,6 +1836,7 @@ public abstract class Window {
/**
* @return the color of the status bar.
*/
+ @ColorInt
public abstract int getStatusBarColor();
/**
@@ -1852,11 +1854,12 @@ public abstract class Window {
* The transitionName for the view background will be "android:status:background".
* </p>
*/
- public abstract void setStatusBarColor(int color);
+ public abstract void setStatusBarColor(@ColorInt int color);
/**
* @return the color of the navigation bar.
*/
+ @ColorInt
public abstract int getNavigationBarColor();
/**
@@ -1874,7 +1877,7 @@ public abstract class Window {
* The transitionName for the view background will be "android:navigation:background".
* </p>
*/
- public abstract void setNavigationBarColor(int color);
+ public abstract void setNavigationBarColor(@ColorInt int color);
}
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index 85d77cb..a5524d8 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -16,6 +16,7 @@
package android.view.animation;
+import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
@@ -622,7 +623,7 @@ public abstract class Animation implements Cloneable {
* @param bg The background color. If 0, no background. Currently must
* be black, with any desired alpha level.
*/
- public void setBackgroundColor(int bg) {
+ public void setBackgroundColor(@ColorInt int bg) {
mBackgroundColor = bg;
}
@@ -753,6 +754,7 @@ public abstract class Animation implements Cloneable {
/**
* Returns the background color behind the animation.
*/
+ @ColorInt
public int getBackgroundColor() {
return mBackgroundColor;
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index a6e2952..168066a 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.content.Context;
import android.content.Intent;
@@ -5982,7 +5983,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
*
* @param color The background color
*/
- public void setCacheColorHint(int color) {
+ public void setCacheColorHint(@ColorInt int color) {
if (color != mCacheColorHint) {
mCacheColorHint = color;
int count = getChildCount();
@@ -6000,6 +6001,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
* @return The cache color hint
*/
@ViewDebug.ExportedProperty(category = "drawing")
+ @ColorInt
public int getCacheColorHint() {
return mCacheColorHint;
}
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index fd1c4b8..5bc16cb 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.Widget;
import android.content.Context;
@@ -140,7 +141,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor
*/
- public void setSelectedWeekBackgroundColor(int color) {
+ public void setSelectedWeekBackgroundColor(@ColorInt int color) {
mDelegate.setSelectedWeekBackgroundColor(color);
}
@@ -151,6 +152,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor
*/
+ @ColorInt
public int getSelectedWeekBackgroundColor() {
return mDelegate.getSelectedWeekBackgroundColor();
}
@@ -162,7 +164,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_focusedMonthDateColor
*/
- public void setFocusedMonthDateColor(int color) {
+ public void setFocusedMonthDateColor(@ColorInt int color) {
mDelegate.setFocusedMonthDateColor(color);
}
@@ -173,6 +175,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_focusedMonthDateColor
*/
+ @ColorInt
public int getFocusedMonthDateColor() {
return mDelegate.getFocusedMonthDateColor();
}
@@ -184,7 +187,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor
*/
- public void setUnfocusedMonthDateColor(int color) {
+ public void setUnfocusedMonthDateColor(@ColorInt int color) {
mDelegate.setUnfocusedMonthDateColor(color);
}
@@ -195,6 +198,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor
*/
+ @ColorInt
public int getUnfocusedMonthDateColor() {
return mDelegate.getUnfocusedMonthDateColor();
}
@@ -206,7 +210,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_weekNumberColor
*/
- public void setWeekNumberColor(int color) {
+ public void setWeekNumberColor(@ColorInt int color) {
mDelegate.setWeekNumberColor(color);
}
@@ -217,6 +221,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_weekNumberColor
*/
+ @ColorInt
public int getWeekNumberColor() {
return mDelegate.getWeekNumberColor();
}
@@ -228,7 +233,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_weekSeparatorLineColor
*/
- public void setWeekSeparatorLineColor(int color) {
+ public void setWeekSeparatorLineColor(@ColorInt int color) {
mDelegate.setWeekSeparatorLineColor(color);
}
@@ -239,6 +244,7 @@ public class CalendarView extends FrameLayout {
*
* @attr ref android.R.styleable#CalendarView_weekSeparatorLineColor
*/
+ @ColorInt
public int getWeekSeparatorLineColor() {
return mDelegate.getWeekSeparatorLineColor();
}
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index 391347e..9019f31 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.ColorInt;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.PorterDuff;
@@ -292,7 +293,7 @@ public class EdgeEffect {
*
* @param color Color in argb
*/
- public void setColor(int color) {
+ public void setColor(@ColorInt int color) {
mPaint.setColor(color);
}
@@ -300,6 +301,7 @@ public class EdgeEffect {
* Return the color of this edge effect in argb.
* @return The color of this edge effect in argb
*/
+ @ColorInt
public int getColor() {
return mPaint.getColor();
}
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index dd7fa18..a10be11 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.ColorInt;
import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.Application;
@@ -2263,7 +2264,7 @@ public class RemoteViews implements Parcelable, Filter {
* @param color Sets the text color for all the states (normal, selected,
* focused) to be this color.
*/
- public void setTextColor(int viewId, int color) {
+ public void setTextColor(int viewId, @ColorInt int color) {
setInt(viewId, "setTextColor", color);
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 9bef1fe..b5cf12e 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -17,6 +17,7 @@
package android.widget;
import android.R;
+import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -2996,7 +2997,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @attr ref android.R.styleable#TextView_textColor
*/
@android.view.RemotableViewMethod
- public void setTextColor(int color) {
+ public void setTextColor(@ColorInt int color) {
mTextColor = ColorStateList.valueOf(color);
updateTextColors();
}
@@ -3037,6 +3038,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*
* @return Returns the current text color.
*/
+ @ColorInt
public final int getCurrentTextColor() {
return mCurTextColor;
}
@@ -3047,7 +3049,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @attr ref android.R.styleable#TextView_textColorHighlight
*/
@android.view.RemotableViewMethod
- public void setHighlightColor(int color) {
+ public void setHighlightColor(@ColorInt int color) {
if (mHighlightColor != color) {
mHighlightColor = color;
invalidate();
@@ -3061,6 +3063,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*
* @attr ref android.R.styleable#TextView_textColorHighlight
*/
+ @ColorInt
public int getHighlightColor() {
return mHighlightColor;
}
@@ -3155,6 +3158,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*
* @attr ref android.R.styleable#TextView_shadowColor
*/
+ @ColorInt
public int getShadowColor() {
return mShadowColor;
}
@@ -3230,7 +3234,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @attr ref android.R.styleable#TextView_textColorHint
*/
@android.view.RemotableViewMethod
- public final void setHintTextColor(int color) {
+ public final void setHintTextColor(@ColorInt int color) {
mHintTextColor = ColorStateList.valueOf(color);
updateTextColors();
}
@@ -3269,6 +3273,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*
* @return Returns the current hint text color.
*/
+ @ColorInt
public final int getCurrentHintTextColor() {
return mHintTextColor != null ? mCurHintTextColor : mCurTextColor;
}
@@ -3282,7 +3287,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @attr ref android.R.styleable#TextView_textColorLink
*/
@android.view.RemotableViewMethod
- public final void setLinkTextColor(int color) {
+ public final void setLinkTextColor(@ColorInt int color) {
mLinkTextColor = ColorStateList.valueOf(color);
updateTextColors();
}
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java
index 9bc2aab..d2430bc 100644
--- a/core/java/android/widget/Toolbar.java
+++ b/core/java/android/widget/Toolbar.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.ColorInt;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActionBar;
@@ -685,7 +686,7 @@ public class Toolbar extends ViewGroup {
*
* @param color The new text color in 0xAARRGGBB format
*/
- public void setTitleTextColor(int color) {
+ public void setTitleTextColor(@ColorInt int color) {
mTitleTextColor = color;
if (mTitleTextView != null) {
mTitleTextView.setTextColor(color);
@@ -697,7 +698,7 @@ public class Toolbar extends ViewGroup {
*
* @param color The new text color in 0xAARRGGBB format
*/
- public void setSubtitleTextColor(int color) {
+ public void setSubtitleTextColor(@ColorInt int color) {
mSubtitleTextColor = color;
if (mSubtitleTextView != null) {
mSubtitleTextView.setTextColor(color);