Lines Matching refs:resources

34 import com.android.resources.ResourceType;
67 Resources resources = new Resources(assets, metrics, config);
68 resources.mContext = context;
69 resources.mLayoutlibCallback = layoutlibCallback;
70 return Resources.mSystem = resources;
83 public static BridgeTypedArray newTypeArray(Resources resources, int numEntries,
85 return new BridgeTypedArray(resources, resources.mContext, numEntries, platformFile);
88 private static Pair<ResourceType, String> getResourceInfo(Resources resources, int id,
93 // Set the layoutlib callback and context for resources
94 if (resources != Resources.mSystem && resources.mLayoutlibCallback == null) {
95 resources.mLayoutlibCallback = Resources.mSystem.mLayoutlibCallback;
96 resources.mContext = Resources.mSystem.mContext;
105 if (resources.mLayoutlibCallback != null) {
106 resourceInfo = resources.mLayoutlibCallback.resolveResourceId(id);
116 private static Pair<String, ResourceValue> getResourceValue(Resources resources, int id,
119 getResourceInfo(resources, id, platformResFlag_out);
123 RenderResources renderResources = resources.mContext.getRenderResources();
133 static Drawable getDrawable(Resources resources, int id) {
134 return getDrawable(resources, id, null);
138 static Drawable getDrawable(Resources resources, int id, Theme theme) {
139 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
142 return ResourceHelper.getDrawable(value.getSecond(), resources.mContext, theme);
146 throwException(resources, id);
153 static int getColor(Resources resources, int id) {
154 return getColor(resources, id, null);
158 static int getColor(Resources resources, int id, Theme theme) throws NotFoundException {
159 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
184 return getColorStateList(resources, id, theme).getDefaultColor();
188 static ColorStateList getColorStateList(Resources resources, int id) throws NotFoundException {
189 return getColorStateList(resources, id, null);
193 static ColorStateList getColorStateList(Resources resources, int id, Theme theme)
196 getResourceValue(resources, id, mPlatformResourceFlag);
200 resources.mContext);
207 throwException(resources, id);
214 static CharSequence getText(Resources resources, int id, CharSequence def) {
215 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
233 static CharSequence getText(Resources resources, int id) throws NotFoundException {
234 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
249 throwException(resources, id);
256 static CharSequence[] getTextArray(Resources resources, int id) throws NotFoundException {
257 ResourceValue resValue = getArrayResourceValue(resources, id);
263 resolveReference(resources, resValue.getValue(), resValue.isFramework())};
266 return fillValues(resources, arv, new CharSequence[arv.getElementCount()]);
270 static String[] getStringArray(Resources resources, int id) throws NotFoundException {
271 ResourceValue resValue = getArrayResourceValue(resources, id);
277 resolveReference(resources, resValue.getValue(), resValue.isFramework())};
280 return fillValues(resources, arv, new String[arv.getElementCount()]);
288 static <T extends CharSequence> T[] fillValues(Resources resources, ArrayResourceValue resValue,
293 T s = (T) resolveReference(resources, iterator.next(), resValue.isFramework());
300 static int[] getIntArray(Resources resources, int id) throws NotFoundException {
301 ResourceValue rv = getArrayResourceValue(resources, id);
307 String firstValue = resolveReference(resources, rv.getValue(), rv.isFramework());
321 String element = resolveReference(resources, iterator.next(), resValue.isFramework());
339 * parse the array resources properly.
345 private static ResourceValue getArrayResourceValue(Resources resources, int id)
347 Pair<String, ResourceValue> v = getResourceValue(resources, id, mPlatformResourceFlag);
373 throwException(resources, id);
380 private static String resolveReference(Resources resources, @NonNull String ref,
385 resources.mContext.getRenderResources().findResValue(ref, forceFrameworkOnly);
386 rv = resources.mContext.getRenderResources().resolveResValue(rv);
399 static XmlResourceParser getLayout(Resources resources, int id) throws NotFoundException {
400 Pair<String, ResourceValue> v = getResourceValue(resources, id, mPlatformResourceFlag);
409 parser = resources.mLayoutlibCallback.getParser(value);
423 return new BridgeXmlBlockParser(parser, resources.mContext,
437 throwException(resources, id);
444 static XmlResourceParser getAnimation(Resources resources, int id) throws NotFoundException {
445 Pair<String, ResourceValue> v = getResourceValue(resources, id, mPlatformResourceFlag);
458 return new BridgeXmlBlockParser(parser, resources.mContext,
472 throwException(resources, id);
479 static TypedArray obtainAttributes(Resources resources, AttributeSet set, int[] attrs) {
480 return resources.mContext.obtainStyledAttributes(set, attrs);
484 static TypedArray obtainAttributes(Resources resources, Resources.Theme theme, AttributeSet
486 return Resources.obtainAttributes_Original(resources, theme, set, attrs);
490 static TypedArray obtainTypedArray(Resources resources, int id) throws NotFoundException {
495 static float getDimension(Resources resources, int id) throws NotFoundException {
496 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
515 return tmpValue.getDimension(resources.getDisplayMetrics());
522 throwException(resources, id);
529 static int getDimensionPixelOffset(Resources resources, int id) throws NotFoundException {
530 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
544 resources.getDisplayMetrics());
551 throwException(resources, id);
558 static int getDimensionPixelSize(Resources resources, int id) throws NotFoundException {
559 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
573 resources.getDisplayMetrics());
580 throwException(resources, id);
587 static int getInteger(Resources resources, int id) throws NotFoundException {
588 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
607 throwException(resources, id);
614 static boolean getBoolean(Resources resources, int id) throws NotFoundException {
615 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
629 throwException(resources, id);
636 static String getResourceEntryName(Resources resources, int resid) throws NotFoundException {
637 Pair<ResourceType, String> resourceInfo = getResourceInfo(resources, resid, new boolean[1]);
647 static String getResourceName(Resources resources, int resid) throws NotFoundException {
649 Pair<ResourceType, String> resourceInfo = getResourceInfo(resources, resid, platformOut);
655 packageName = resources.mContext.getPackageName();
666 static String getResourcePackageName(Resources resources, int resid) throws NotFoundException {
668 Pair<ResourceType, String> resourceInfo = getResourceInfo(resources, resid, platformOut);
673 String packageName = resources.mContext.getPackageName();
681 static String getResourceTypeName(Resources resources, int resid) throws NotFoundException {
682 Pair<ResourceType, String> resourceInfo = getResourceInfo(resources, resid, new boolean[1]);
691 static String getString(Resources resources, int id, Object... formatArgs)
693 String s = getString(resources, id);
700 throwException(resources, id);
707 static String getString(Resources resources, int id) throws NotFoundException {
708 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
715 throwException(resources, id);
722 static void getValue(Resources resources, int id, TypedValue outValue, boolean resolveRefs)
724 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
748 throwException(resources, id);
752 static void getValue(Resources resources, String name, TypedValue outValue, boolean resolveRefs)
758 static XmlResourceParser getXml(Resources resources, int id) throws NotFoundException {
759 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
771 return new BridgeXmlBlockParser(parser, resources.mContext,
787 throwException(resources, id);
794 static XmlResourceParser loadXmlResourceParser(Resources resources, int id,
796 return resources.loadXmlResourceParser_Original(id, type);
800 static XmlResourceParser loadXmlResourceParser(Resources resources, String file, int id,
805 getResourceValue(resources, id, mPlatformResourceFlag);
811 return new BridgeXmlBlockParser(parser, resources.mContext, mPlatformResourceFlag[0]);
824 static InputStream openRawResource(Resources resources, int id) throws NotFoundException {
825 Pair<String, ResourceValue> value = getResourceValue(resources, id, mPlatformResourceFlag);
852 throwException(resources, id);
859 static InputStream openRawResource(Resources resources, int id, TypedValue value) throws
861 getValue(resources, id, value, true);
886 static AssetFileDescriptor openRawResourceFd(Resources resources, int id) throws
899 private static void throwException(Resources resources, int id) throws NotFoundException {
900 throwException(id, getResourceInfo(resources, id, new boolean[1]));