am 34f5991e: Merge 6103e22c from honeycomb-mr1. do not merge.
* commit '34f5991ebe8b203f1720caf95889c15dd131d86e': Merge 6103e22c from honeycomb-mr1. do not merge.
This commit is contained in:
@@ -509,14 +509,13 @@ public final class BridgeContext extends Activity {
|
|||||||
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
|
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
|
||||||
isPlatformFile);
|
isPlatformFile);
|
||||||
|
|
||||||
// resolve the defStyleAttr value into a IStyleResourceValue
|
|
||||||
StyleResourceValue defStyleValues = null;
|
|
||||||
|
|
||||||
// look for a custom style.
|
// look for a custom style.
|
||||||
String customStyle = null;
|
String customStyle = null;
|
||||||
if (set != null) {
|
if (set != null) {
|
||||||
customStyle = set.getAttributeValue(null /* namespace*/, "style");
|
customStyle = set.getAttributeValue(null /* namespace*/, "style");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyleResourceValue customStyleValues = null;
|
||||||
if (customStyle != null) {
|
if (customStyle != null) {
|
||||||
ResourceValue item = mRenderResources.findResValue(customStyle,
|
ResourceValue item = mRenderResources.findResValue(customStyle,
|
||||||
false /*forceFrameworkOnly*/);
|
false /*forceFrameworkOnly*/);
|
||||||
@@ -525,75 +524,76 @@ public final class BridgeContext extends Activity {
|
|||||||
item = mRenderResources.resolveResValue(item);
|
item = mRenderResources.resolveResValue(item);
|
||||||
|
|
||||||
if (item instanceof StyleResourceValue) {
|
if (item instanceof StyleResourceValue) {
|
||||||
defStyleValues = (StyleResourceValue)item;
|
customStyleValues = (StyleResourceValue)item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defStyleValues == null) {
|
// resolve the defStyleAttr value into a IStyleResourceValue
|
||||||
if (defStyleAttr != 0) {
|
StyleResourceValue defStyleValues = null;
|
||||||
// get the name from the int.
|
|
||||||
String defStyleName = searchAttr(defStyleAttr);
|
|
||||||
|
|
||||||
if (defaultPropMap != null) {
|
if (defStyleAttr != 0) {
|
||||||
defaultPropMap.put("style", defStyleName);
|
// get the name from the int.
|
||||||
|
String defStyleName = searchAttr(defStyleAttr);
|
||||||
|
|
||||||
|
if (defaultPropMap != null) {
|
||||||
|
defaultPropMap.put("style", defStyleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for the style in the current theme, and its parent:
|
||||||
|
ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
|
||||||
|
|
||||||
|
if (item != null) {
|
||||||
|
// item is a reference to a style entry. Search for it.
|
||||||
|
item = mRenderResources.findResValue(item.getValue(),
|
||||||
|
false /*forceFrameworkOnly*/);
|
||||||
|
|
||||||
|
if (item instanceof StyleResourceValue) {
|
||||||
|
defStyleValues = (StyleResourceValue)item;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Bridge.getLog().error(null,
|
||||||
|
String.format(
|
||||||
|
"Failed to find style '%s' in current theme", defStyleName),
|
||||||
|
null /*data*/);
|
||||||
|
}
|
||||||
|
} else if (defStyleRes != 0) {
|
||||||
|
Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes);
|
||||||
|
if (value == null) {
|
||||||
|
value = mProjectCallback.resolveResourceId(defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
// look for the style in the current theme, and its parent:
|
if (value != null) {
|
||||||
ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
|
if (value.getFirst() == ResourceType.STYLE) {
|
||||||
|
// look for the style in the current theme, and its parent:
|
||||||
if (item != null) {
|
ResourceValue item = mRenderResources.findItemInTheme(value.getSecond());
|
||||||
// item is a reference to a style entry. Search for it.
|
if (item != null) {
|
||||||
item = mRenderResources.findResValue(item.getValue(),
|
if (item instanceof StyleResourceValue) {
|
||||||
false /*forceFrameworkOnly*/);
|
if (defaultPropMap != null) {
|
||||||
|
defaultPropMap.put("style", item.getName());
|
||||||
if (item instanceof StyleResourceValue) {
|
|
||||||
defStyleValues = (StyleResourceValue)item;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Bridge.getLog().error(null,
|
|
||||||
String.format(
|
|
||||||
"Failed to find style '%s' in current theme", defStyleName),
|
|
||||||
null /*data*/);
|
|
||||||
}
|
|
||||||
} else if (defStyleRes != 0) {
|
|
||||||
Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes);
|
|
||||||
if (value == null) {
|
|
||||||
value = mProjectCallback.resolveResourceId(defStyleRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value != null) {
|
|
||||||
if (value.getFirst() == ResourceType.STYLE) {
|
|
||||||
// look for the style in the current theme, and its parent:
|
|
||||||
ResourceValue item = mRenderResources.findItemInTheme(value.getSecond());
|
|
||||||
if (item != null) {
|
|
||||||
if (item instanceof StyleResourceValue) {
|
|
||||||
if (defaultPropMap != null) {
|
|
||||||
defaultPropMap.put("style", item.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
defStyleValues = (StyleResourceValue)item;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Bridge.getLog().error(null,
|
defStyleValues = (StyleResourceValue)item;
|
||||||
String.format(
|
|
||||||
"Style with id 0x%x (resolved to '%s') does not exist.",
|
|
||||||
defStyleRes, value.getSecond()),
|
|
||||||
null /*data*/);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(null,
|
||||||
String.format(
|
String.format(
|
||||||
"Resouce id 0x%x is not of type STYLE (instead %s)",
|
"Style with id 0x%x (resolved to '%s') does not exist.",
|
||||||
defStyleRes, value.getFirst().toString()),
|
defStyleRes, value.getSecond()),
|
||||||
null /*data*/);
|
null /*data*/);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(null,
|
||||||
String.format(
|
String.format(
|
||||||
"Failed to find style with id 0x%x in current theme",
|
"Resouce id 0x%x is not of type STYLE (instead %s)",
|
||||||
defStyleRes),
|
defStyleRes, value.getFirst().toString()),
|
||||||
null /*data*/);
|
null /*data*/);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Bridge.getLog().error(null,
|
||||||
|
String.format(
|
||||||
|
"Failed to find style with id 0x%x in current theme",
|
||||||
|
defStyleRes),
|
||||||
|
null /*data*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +618,13 @@ public final class BridgeContext extends Activity {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
ResourceValue resValue = null;
|
ResourceValue resValue = null;
|
||||||
|
|
||||||
// look for the value in the defStyle first (and its parent if needed)
|
// look for the value in the custom style first (and its parent if needed)
|
||||||
if (defStyleValues != null) {
|
if (customStyleValues != null) {
|
||||||
|
resValue = mRenderResources.findItemInStyle(customStyleValues, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// then look for the value in the default Style (and its parent if needed)
|
||||||
|
if (resValue == null && defStyleValues != null) {
|
||||||
resValue = mRenderResources.findItemInStyle(defStyleValues, name);
|
resValue = mRenderResources.findItemInStyle(defStyleValues, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user