Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +60 −24 Original line number Diff line number Diff line Loading @@ -425,7 +425,8 @@ public final class BridgeContext extends Activity { } } if (defStyleValues == null && defStyleAttr != 0) { if (defStyleValues == null) { if (defStyleAttr != 0) { // get the name from the int. String defStyleName = searchAttr(defStyleAttr); Loading @@ -450,11 +451,46 @@ public final class BridgeContext extends Activity { "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 (defStyleRes != 0) { // FIXME: See what we need to do with this. throw new UnsupportedOperationException(); 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, String.format( "Style with id 0x%x (resolved to '%s') does not exist.", defStyleRes, value.getSecond()), null /*data*/); } } else { Bridge.getLog().error(null, String.format( "Resouce id 0x%x is not of type STYLE (instead %s)", defStyleRes, value.getFirst().toString()), null /*data*/); } } else { Bridge.getLog().error(null, String.format( "Failed to find style with id 0x%x in current theme", defStyleRes), null /*data*/); } } } String namespace = BridgeConstants.NS_RESOURCES; Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +60 −24 Original line number Diff line number Diff line Loading @@ -425,7 +425,8 @@ public final class BridgeContext extends Activity { } } if (defStyleValues == null && defStyleAttr != 0) { if (defStyleValues == null) { if (defStyleAttr != 0) { // get the name from the int. String defStyleName = searchAttr(defStyleAttr); Loading @@ -450,11 +451,46 @@ public final class BridgeContext extends Activity { "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 (defStyleRes != 0) { // FIXME: See what we need to do with this. throw new UnsupportedOperationException(); 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, String.format( "Style with id 0x%x (resolved to '%s') does not exist.", defStyleRes, value.getSecond()), null /*data*/); } } else { Bridge.getLog().error(null, String.format( "Resouce id 0x%x is not of type STYLE (instead %s)", defStyleRes, value.getFirst().toString()), null /*data*/); } } else { Bridge.getLog().error(null, String.format( "Failed to find style with id 0x%x in current theme", defStyleRes), null /*data*/); } } } String namespace = BridgeConstants.NS_RESOURCES; Loading