Loading core/java/android/content/res/Resources.java +17 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.util.DisplayMetrics; import android.util.Log; import android.util.SparseArray; import android.util.TypedValue; import android.content.Context; import java.io.IOException; import java.io.InputStream; Loading Loading @@ -82,6 +83,8 @@ public class Resources { /*package*/ final DisplayMetrics mMetrics = new DisplayMetrics(); PluralRules mPluralRule; private Context context; /** * This exception is thrown by the resource APIs when a requested resource * can not be found. Loading Loading @@ -877,6 +880,20 @@ public class Resources { throw new NotFoundException("String resource name " + name); } /** * @hide */ public Context getContext() { return context; } /** * @hide */ public void setContext(Context _context) { context = _context; } /** * This class holds the current attribute values for a particular theme. * In other words, a Theme is a set of values for resource attributes; Loading core/java/android/content/res/TypedArray.java +6 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.content.Context; import com.android.internal.util.XmlUtils; import java.util.Arrays; Loading Loading @@ -268,6 +269,9 @@ public class TypedArray { return csl.getDefaultColor(); } return defValue; } else if (type == TypedValue.TYPE_ATTRIBUTE && mResources.getContext() != null) { mResources.getContext().getTheme().resolveAttribute(data[index+AssetManager.STYLE_DATA], mValue, true); return mValue.data; } throw new UnsupportedOperationException("Can't convert to color: type=0x" Loading core/java/android/view/View.java +2 −0 Original line number Diff line number Diff line Loading @@ -1722,7 +1722,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { int attr = a.getIndex(i); switch (attr) { case com.android.internal.R.styleable.View_background: a.getResources().setContext(context); background = a.getDrawable(attr); a.getResources().setContext(null); break; case com.android.internal.R.styleable.View_padding: padding = a.getDimensionPixelSize(attr, -1); Loading Loading
core/java/android/content/res/Resources.java +17 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.util.DisplayMetrics; import android.util.Log; import android.util.SparseArray; import android.util.TypedValue; import android.content.Context; import java.io.IOException; import java.io.InputStream; Loading Loading @@ -82,6 +83,8 @@ public class Resources { /*package*/ final DisplayMetrics mMetrics = new DisplayMetrics(); PluralRules mPluralRule; private Context context; /** * This exception is thrown by the resource APIs when a requested resource * can not be found. Loading Loading @@ -877,6 +880,20 @@ public class Resources { throw new NotFoundException("String resource name " + name); } /** * @hide */ public Context getContext() { return context; } /** * @hide */ public void setContext(Context _context) { context = _context; } /** * This class holds the current attribute values for a particular theme. * In other words, a Theme is a set of values for resource attributes; Loading
core/java/android/content/res/TypedArray.java +6 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.content.Context; import com.android.internal.util.XmlUtils; import java.util.Arrays; Loading Loading @@ -268,6 +269,9 @@ public class TypedArray { return csl.getDefaultColor(); } return defValue; } else if (type == TypedValue.TYPE_ATTRIBUTE && mResources.getContext() != null) { mResources.getContext().getTheme().resolveAttribute(data[index+AssetManager.STYLE_DATA], mValue, true); return mValue.data; } throw new UnsupportedOperationException("Can't convert to color: type=0x" Loading
core/java/android/view/View.java +2 −0 Original line number Diff line number Diff line Loading @@ -1722,7 +1722,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { int attr = a.getIndex(i); switch (attr) { case com.android.internal.R.styleable.View_background: a.getResources().setContext(context); background = a.getDrawable(attr); a.getResources().setContext(null); break; case com.android.internal.R.styleable.View_padding: padding = a.getDimensionPixelSize(attr, -1); Loading