automerge: 1575ca6
* commit '1575ca6e1a713f9d2e4a9f91bc6943ae10fde083':
Resource resolution fixes.
This commit is contained in:
@@ -614,15 +614,27 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
|
|
||||||
int pos = value.indexOf('/');
|
int pos = value.indexOf('/');
|
||||||
String idName = value.substring(pos + 1);
|
String idName = value.substring(pos + 1);
|
||||||
|
boolean create = value.startsWith("@+");
|
||||||
|
boolean isFrameworkId =
|
||||||
|
mPlatformFile || value.startsWith("@android") || value.startsWith("@+android");
|
||||||
|
|
||||||
// if this is a framework id
|
// Look for the idName in project or android R class depending on isPlatform.
|
||||||
if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) {
|
if (create) {
|
||||||
// look for idName in the android R classes
|
Integer idValue;
|
||||||
return mContext.getFrameworkResourceValue(ResourceType.ID, idName, defValue);
|
if (isFrameworkId) {
|
||||||
|
idValue = Bridge.getResourceId(ResourceType.ID, idName);
|
||||||
|
} else {
|
||||||
|
idValue = mContext.getProjectCallback().getResourceId(ResourceType.ID, idName);
|
||||||
|
}
|
||||||
|
return idValue == null ? defValue : idValue;
|
||||||
|
}
|
||||||
|
// This calls the same method as in if(create), but doesn't create a dynamic id, if
|
||||||
|
// one is not found.
|
||||||
|
if (isFrameworkId) {
|
||||||
|
return mContext.getFrameworkResourceValue(ResourceType.ID, idName, defValue);
|
||||||
|
} else {
|
||||||
|
return mContext.getProjectResourceValue(ResourceType.ID, idName, defValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for idName in the project R class.
|
|
||||||
return mContext.getProjectResourceValue(ResourceType.ID, idName, defValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// not a direct id valid reference? resolve it
|
// not a direct id valid reference? resolve it
|
||||||
|
|||||||
@@ -289,6 +289,11 @@ public final class BridgeContext extends Context {
|
|||||||
value = mRenderResources.resolveResValue(value);
|
value = mRenderResources.resolveResValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value == null) {
|
||||||
|
// unable to find the attribute.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check if this is a style resource
|
// check if this is a style resource
|
||||||
if (value instanceof StyleResourceValue) {
|
if (value instanceof StyleResourceValue) {
|
||||||
// get the id that will represent this style.
|
// get the id that will represent this style.
|
||||||
@@ -296,7 +301,6 @@ public final class BridgeContext extends Context {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
// if this is a framework value.
|
// if this is a framework value.
|
||||||
if (value.isFramework()) {
|
if (value.isFramework()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user