Merge "Fix resource type annotations for obtainStyledAttributes"
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.content;
|
||||
|
||||
import android.annotation.AttrRes;
|
||||
import android.annotation.CheckResult;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
@@ -474,8 +475,7 @@ public abstract class Context {
|
||||
*
|
||||
* @see android.content.res.Resources.Theme#obtainStyledAttributes(int[])
|
||||
*/
|
||||
public final TypedArray obtainStyledAttributes(
|
||||
int[] attrs) {
|
||||
public final TypedArray obtainStyledAttributes(@StyleableRes int[] attrs) {
|
||||
return getTheme().obtainStyledAttributes(attrs);
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ public abstract class Context {
|
||||
* @see android.content.res.Resources.Theme#obtainStyledAttributes(int, int[])
|
||||
*/
|
||||
public final TypedArray obtainStyledAttributes(
|
||||
@StyleableRes int resid, int[] attrs) throws Resources.NotFoundException {
|
||||
@StyleRes int resid, @StyleableRes int[] attrs) throws Resources.NotFoundException {
|
||||
return getTheme().obtainStyledAttributes(resid, attrs);
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ public abstract class Context {
|
||||
* @see android.content.res.Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int)
|
||||
*/
|
||||
public final TypedArray obtainStyledAttributes(
|
||||
AttributeSet set, int[] attrs) {
|
||||
AttributeSet set, @StyleableRes int[] attrs) {
|
||||
return getTheme().obtainStyledAttributes(set, attrs, 0, 0);
|
||||
}
|
||||
|
||||
@@ -511,7 +511,8 @@ public abstract class Context {
|
||||
* @see android.content.res.Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int)
|
||||
*/
|
||||
public final TypedArray obtainStyledAttributes(
|
||||
AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes) {
|
||||
AttributeSet set, @StyleableRes int[] attrs, @AttrRes int defStyleAttr,
|
||||
@StyleRes int defStyleRes) {
|
||||
return getTheme().obtainStyledAttributes(
|
||||
set, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package android.content.res;
|
||||
|
||||
import android.annotation.AttrRes;
|
||||
import android.annotation.ColorInt;
|
||||
import android.annotation.StyleRes;
|
||||
import android.annotation.StyleableRes;
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
@@ -1472,7 +1475,7 @@ public class Resources {
|
||||
* @see #obtainStyledAttributes(int, int[])
|
||||
* @see #obtainStyledAttributes(AttributeSet, int[], int, int)
|
||||
*/
|
||||
public TypedArray obtainStyledAttributes(int[] attrs) {
|
||||
public TypedArray obtainStyledAttributes(@StyleableRes int[] attrs) {
|
||||
final int len = attrs.length;
|
||||
final TypedArray array = TypedArray.obtain(Resources.this, len);
|
||||
array.mTheme = this;
|
||||
@@ -1500,7 +1503,8 @@ public class Resources {
|
||||
* @see #obtainStyledAttributes(int[])
|
||||
* @see #obtainStyledAttributes(AttributeSet, int[], int, int)
|
||||
*/
|
||||
public TypedArray obtainStyledAttributes(int resid, int[] attrs) throws NotFoundException {
|
||||
public TypedArray obtainStyledAttributes(@StyleRes int resid, @StyleableRes int[] attrs)
|
||||
throws NotFoundException {
|
||||
final int len = attrs.length;
|
||||
final TypedArray array = TypedArray.obtain(Resources.this, len);
|
||||
array.mTheme = this;
|
||||
@@ -1583,7 +1587,7 @@ public class Resources {
|
||||
* @see #obtainStyledAttributes(int, int[])
|
||||
*/
|
||||
public TypedArray obtainStyledAttributes(AttributeSet set,
|
||||
int[] attrs, int defStyleAttr, int defStyleRes) {
|
||||
@StyleableRes int[] attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
|
||||
final int len = attrs.length;
|
||||
final TypedArray array = TypedArray.obtain(Resources.this, len);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user