summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/preference/PreferenceFragment.java3
-rw-r--r--core/java/android/speech/tts/TextToSpeech.java2
-rw-r--r--core/java/android/view/ContextThemeWrapper.java3
-rw-r--r--core/java/android/view/View.java3
-rw-r--r--core/java/android/view/Window.java3
-rw-r--r--core/java/android/view/animation/Animation.java3
-rw-r--r--core/java/android/view/animation/LayoutAnimationController.java6
-rw-r--r--core/java/android/widget/ActionMenuView.java3
-rw-r--r--core/java/android/widget/ArrayAdapter.java11
-rw-r--r--core/java/android/widget/FastScroller.java3
-rw-r--r--core/java/android/widget/SimpleAdapter.java4
-rw-r--r--core/java/android/widget/Toolbar.java24
-rw-r--r--core/java/android/widget/ViewAnimator.java5
-rw-r--r--graphics/java/android/graphics/PorterDuffColorFilter.java3
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java2
15 files changed, 49 insertions, 29 deletions
diff --git a/core/java/android/preference/PreferenceFragment.java b/core/java/android/preference/PreferenceFragment.java
index 29f9ca1..66642de 100644
--- a/core/java/android/preference/PreferenceFragment.java
+++ b/core/java/android/preference/PreferenceFragment.java
@@ -17,6 +17,7 @@
package android.preference;
import android.annotation.Nullable;
+import android.annotation.XmlRes;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
@@ -294,7 +295,7 @@ public abstract class PreferenceFragment extends Fragment implements
*
* @param preferencesResId The XML resource ID to inflate.
*/
- public void addPreferencesFromResource(int preferencesResId) {
+ public void addPreferencesFromResource(@XmlRes int preferencesResId) {
requirePreferenceManager();
setPreferenceScreen(mPreferenceManager.inflateFromResource(getActivity(),
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 668e028..13fb657 100644
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -918,7 +918,7 @@ public class TextToSpeech {
*
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
- public int addSpeech(CharSequence text, String packagename, int resourceId) {
+ public int addSpeech(CharSequence text, String packagename, @RawRes int resourceId) {
synchronized (mStartLock) {
mUtterances.put(text, makeResourceUri(packagename, resourceId));
return SUCCESS;
diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java
index d9f6054..9047b1d 100644
--- a/core/java/android/view/ContextThemeWrapper.java
+++ b/core/java/android/view/ContextThemeWrapper.java
@@ -16,6 +16,7 @@
package android.view;
+import android.annotation.StyleRes;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
@@ -36,7 +37,7 @@ public class ContextThemeWrapper extends ContextWrapper {
super(null);
}
- public ContextThemeWrapper(Context base, int themeResId) {
+ public ContextThemeWrapper(Context base, @StyleRes int themeResId) {
super(base);
mThemeResource = themeResId;
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 085a3f2..23be716 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -24,6 +24,7 @@ import android.annotation.DrawableRes;
import android.annotation.FloatRange;
import android.annotation.IdRes;
import android.annotation.IntDef;
+import android.annotation.LayoutRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Size;
@@ -18614,7 +18615,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* layout_* parameters.
* @see LayoutInflater
*/
- public static View inflate(Context context, int resource, ViewGroup root) {
+ public static View inflate(Context context, @LayoutRes int resource, ViewGroup root) {
LayoutInflater factory = LayoutInflater.from(context);
return factory.inflate(resource, root);
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 744f665..ddc1d5a 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -22,6 +22,7 @@ import android.annotation.IdRes;
import android.annotation.LayoutRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.StyleRes;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.res.Configuration;
@@ -738,7 +739,7 @@ public abstract class Window {
* 0 here will override the animations the window would
* normally retrieve from its theme.
*/
- public void setWindowAnimations(int resId) {
+ public void setWindowAnimations(@StyleRes int resId) {
final WindowManager.LayoutParams attrs = getAttributes();
attrs.windowAnimations = resId;
dispatchWindowAttributesChanged(attrs);
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index a5524d8..be43952 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -17,6 +17,7 @@
package android.view.animation;
import android.annotation.ColorInt;
+import android.annotation.InterpolatorRes;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
@@ -388,7 +389,7 @@ public abstract class Animation implements Cloneable {
* @param resID The resource identifier of the interpolator to load
* @attr ref android.R.styleable#Animation_interpolator
*/
- public void setInterpolator(Context context, int resID) {
+ public void setInterpolator(Context context, @InterpolatorRes int resID) {
setInterpolator(AnimationUtils.loadInterpolator(context, resID));
}
diff --git a/core/java/android/view/animation/LayoutAnimationController.java b/core/java/android/view/animation/LayoutAnimationController.java
index 882e738..df2f18c 100644
--- a/core/java/android/view/animation/LayoutAnimationController.java
+++ b/core/java/android/view/animation/LayoutAnimationController.java
@@ -16,6 +16,8 @@
package android.view.animation;
+import android.annotation.AnimRes;
+import android.annotation.InterpolatorRes;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
@@ -180,7 +182,7 @@ public class LayoutAnimationController {
*
* @attr ref android.R.styleable#LayoutAnimation_animation
*/
- public void setAnimation(Context context, int resourceID) {
+ public void setAnimation(Context context, @AnimRes int resourceID) {
setAnimation(AnimationUtils.loadAnimation(context, resourceID));
}
@@ -225,7 +227,7 @@ public class LayoutAnimationController {
*
* @attr ref android.R.styleable#LayoutAnimation_interpolator
*/
- public void setInterpolator(Context context, int resourceID) {
+ public void setInterpolator(Context context, @InterpolatorRes int resourceID) {
setInterpolator(AnimationUtils.loadInterpolator(context, resourceID));
}
diff --git a/core/java/android/widget/ActionMenuView.java b/core/java/android/widget/ActionMenuView.java
index 9d3a5dc..d6f2276 100644
--- a/core/java/android/widget/ActionMenuView.java
+++ b/core/java/android/widget/ActionMenuView.java
@@ -15,6 +15,7 @@
*/
package android.widget;
+import android.annotation.StyleRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
@@ -86,7 +87,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo
* @param resId theme used to inflate popup menus
* @see #getPopupTheme()
*/
- public void setPopupTheme(int resId) {
+ public void setPopupTheme(@StyleRes int resId) {
if (mPopupTheme != resId) {
mPopupTheme = resId;
if (resId == 0) {
diff --git a/core/java/android/widget/ArrayAdapter.java b/core/java/android/widget/ArrayAdapter.java
index 89e508f..ae94a10 100644
--- a/core/java/android/widget/ArrayAdapter.java
+++ b/core/java/android/widget/ArrayAdapter.java
@@ -19,6 +19,7 @@ package android.widget;
import android.annotation.ArrayRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
@@ -133,7 +134,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable,
* instantiating views.
* @param objects The objects to represent in the ListView.
*/
- public ArrayAdapter(Context context, @LayoutRes int resource, T[] objects) {
+ public ArrayAdapter(Context context, @LayoutRes int resource, @NonNull T[] objects) {
this(context, resource, 0, Arrays.asList(objects));
}
@@ -146,7 +147,8 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable,
* @param textViewResourceId The id of the TextView within the layout resource to be populated
* @param objects The objects to represent in the ListView.
*/
- public ArrayAdapter(Context context, @LayoutRes int resource, @IdRes int textViewResourceId, T[] objects) {
+ public ArrayAdapter(Context context, @LayoutRes int resource, @IdRes int textViewResourceId,
+ @NonNull T[] objects) {
this(context, resource, textViewResourceId, Arrays.asList(objects));
}
@@ -158,7 +160,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable,
* instantiating views.
* @param objects The objects to represent in the ListView.
*/
- public ArrayAdapter(Context context, @LayoutRes int resource, List<T> objects) {
+ public ArrayAdapter(Context context, @LayoutRes int resource, @NonNull List<T> objects) {
this(context, resource, 0, objects);
}
@@ -171,7 +173,8 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable,
* @param textViewResourceId The id of the TextView within the layout resource to be populated
* @param objects The objects to represent in the ListView.
*/
- public ArrayAdapter(Context context, int resource, int textViewResourceId, List<T> objects) {
+ public ArrayAdapter(Context context, @LayoutRes int resource, @IdRes int textViewResourceId,
+ @NonNull List<T> objects) {
mContext = context;
mInflater = LayoutInflater.from(context);
mResource = mDropDownResource = resource;
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index fe143de..133e102 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -22,6 +22,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
+import android.annotation.StyleRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
@@ -326,7 +327,7 @@ class FastScroller {
refreshDrawablePressedState();
}
- public void setStyle(int resId) {
+ public void setStyle(@StyleRes int resId) {
final Context context = mList.getContext();
final TypedArray ta = context.obtainStyledAttributes(null,
com.android.internal.R.styleable.FastScroll, android.R.attr.fastScrollStyle, resId);
diff --git a/core/java/android/widget/SimpleAdapter.java b/core/java/android/widget/SimpleAdapter.java
index a656712..2008ba8 100644
--- a/core/java/android/widget/SimpleAdapter.java
+++ b/core/java/android/widget/SimpleAdapter.java
@@ -16,6 +16,8 @@
package android.widget;
+import android.annotation.IdRes;
+import android.annotation.LayoutRes;
import android.content.Context;
import android.content.res.Resources;
import android.view.ContextThemeWrapper;
@@ -82,7 +84,7 @@ public class SimpleAdapter extends BaseAdapter implements Filterable, Spinner.Th
* in the from parameter.
*/
public SimpleAdapter(Context context, List<? extends Map<String, ?>> data,
- int resource, String[] from, int[] to) {
+ @LayoutRes int resource, String[] from, @IdRes int[] to) {
mData = data;
mResource = mDropDownResource = resource;
mFrom = from;
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java
index d2430bc..087406a 100644
--- a/core/java/android/widget/Toolbar.java
+++ b/core/java/android/widget/Toolbar.java
@@ -17,8 +17,12 @@
package android.widget;
import android.annotation.ColorInt;
+import android.annotation.DrawableRes;
+import android.annotation.MenuRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.StringRes;
+import android.annotation.StyleRes;
import android.app.ActionBar;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -296,7 +300,7 @@ public class Toolbar extends ViewGroup {
* @param resId theme used to inflate popup menus
* @see #getPopupTheme()
*/
- public void setPopupTheme(int resId) {
+ public void setPopupTheme(@StyleRes int resId) {
if (mPopupTheme != resId) {
mPopupTheme = resId;
if (resId == 0) {
@@ -331,7 +335,7 @@ public class Toolbar extends ViewGroup {
*
* @param resId ID of a drawable resource
*/
- public void setLogo(int resId) {
+ public void setLogo(@DrawableRes int resId) {
setLogo(getContext().getDrawable(resId));
}
@@ -481,7 +485,7 @@ public class Toolbar extends ViewGroup {
*
* @param resId String resource id
*/
- public void setLogoDescription(int resId) {
+ public void setLogoDescription(@StringRes int resId) {
setLogoDescription(getContext().getText(resId));
}
@@ -566,7 +570,7 @@ public class Toolbar extends ViewGroup {
*
* @param resId Resource ID of a string to set as the title
*/
- public void setTitle(int resId) {
+ public void setTitle(@StringRes int resId) {
setTitle(getContext().getText(resId));
}
@@ -621,7 +625,7 @@ public class Toolbar extends ViewGroup {
*
* @param resId String resource ID
*/
- public void setSubtitle(int resId) {
+ public void setSubtitle(@StringRes int resId) {
setSubtitle(getContext().getText(resId));
}
@@ -663,7 +667,7 @@ public class Toolbar extends ViewGroup {
* Sets the text color, size, style, hint color, and highlight color
* from the specified TextAppearance resource.
*/
- public void setTitleTextAppearance(Context context, int resId) {
+ public void setTitleTextAppearance(Context context, @StyleRes int resId) {
mTitleTextAppearance = resId;
if (mTitleTextView != null) {
mTitleTextView.setTextAppearance(context, resId);
@@ -674,7 +678,7 @@ public class Toolbar extends ViewGroup {
* Sets the text color, size, style, hint color, and highlight color
* from the specified TextAppearance resource.
*/
- public void setSubtitleTextAppearance(Context context, int resId) {
+ public void setSubtitleTextAppearance(Context context, @StyleRes int resId) {
mSubtitleTextAppearance = resId;
if (mSubtitleTextView != null) {
mSubtitleTextView.setTextAppearance(context, resId);
@@ -729,7 +733,7 @@ public class Toolbar extends ViewGroup {
*
* @attr ref android.R.styleable#Toolbar_navigationContentDescription
*/
- public void setNavigationContentDescription(int resId) {
+ public void setNavigationContentDescription(@StringRes int resId) {
setNavigationContentDescription(resId != 0 ? getContext().getText(resId) : null);
}
@@ -766,7 +770,7 @@ public class Toolbar extends ViewGroup {
*
* @attr ref android.R.styleable#Toolbar_navigationIcon
*/
- public void setNavigationIcon(int resId) {
+ public void setNavigationIcon(@DrawableRes int resId) {
setNavigationIcon(getContext().getDrawable(resId));
}
@@ -972,7 +976,7 @@ public class Toolbar extends ViewGroup {
*
* @param resId ID of a menu resource to inflate
*/
- public void inflateMenu(int resId) {
+ public void inflateMenu(@MenuRes int resId) {
getMenuInflater().inflate(resId, getMenu());
}
diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java
index f30fdd8..1580f51 100644
--- a/core/java/android/widget/ViewAnimator.java
+++ b/core/java/android/widget/ViewAnimator.java
@@ -17,6 +17,7 @@
package android.widget;
+import android.annotation.AnimRes;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
@@ -309,7 +310,7 @@ public class ViewAnimator extends FrameLayout {
* @see #getInAnimation()
* @see #setInAnimation(android.view.animation.Animation)
*/
- public void setInAnimation(Context context, int resourceID) {
+ public void setInAnimation(Context context, @AnimRes int resourceID) {
setInAnimation(AnimationUtils.loadAnimation(context, resourceID));
}
@@ -322,7 +323,7 @@ public class ViewAnimator extends FrameLayout {
* @see #getOutAnimation()
* @see #setOutAnimation(android.view.animation.Animation)
*/
- public void setOutAnimation(Context context, int resourceID) {
+ public void setOutAnimation(Context context, @AnimRes int resourceID) {
setOutAnimation(AnimationUtils.loadAnimation(context, resourceID));
}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index bddd224..69d6891 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -16,6 +16,7 @@
package android.graphics;
+import android.annotation.ColorInt;
import android.annotation.NonNull;
/**
@@ -36,7 +37,7 @@ public class PorterDuffColorFilter extends ColorFilter {
* @see #setColor(int)
* @see #setMode(android.graphics.PorterDuff.Mode)
*/
- public PorterDuffColorFilter(int color, @NonNull PorterDuff.Mode mode) {
+ public PorterDuffColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
mColor = color;
mMode = mode;
update();
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 16760c7..56876e9 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -521,7 +521,7 @@ public abstract class Drawable {
* {@link #setTintList(ColorStateList) tint}.
* </p>
*/
- public void setColorFilter(int color, @NonNull PorterDuff.Mode mode) {
+ public void setColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
setColorFilter(new PorterDuffColorFilter(color, mode));
}