Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -188,6 +188,10 @@ public final class BridgeTypedArray extends TypedArray { String s = mResourceData[index].getValue(); String s = mResourceData[index].getValue(); if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } try { try { return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue); return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue); } catch (NumberFormatException e) { } catch (NumberFormatException e) { Loading Loading @@ -301,6 +305,10 @@ public final class BridgeTypedArray extends TypedArray { return null; return null; } } if (RenderResources.REFERENCE_NULL.equals(value)) { return null; } // let the framework inflate the ColorStateList from the XML file. // let the framework inflate the ColorStateList from the XML file. File f = new File(value); File f = new File(value); if (f.isFile()) { if (f.isFile()) { Loading Loading @@ -408,6 +416,10 @@ public final class BridgeTypedArray extends TypedArray { return LayoutParams.WRAP_CONTENT; return LayoutParams.WRAP_CONTENT; } } if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } if (ResourceHelper.stringToFloat(s, mValue)) { if (ResourceHelper.stringToFloat(s, mValue)) { return mValue.getDimension(mBridgeResources.mMetrics); return mValue.getDimension(mBridgeResources.mMetrics); } } Loading Loading @@ -480,6 +492,10 @@ public final class BridgeTypedArray extends TypedArray { return LayoutParams.WRAP_CONTENT; return LayoutParams.WRAP_CONTENT; } } if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } // FIXME huh? // FIXME huh? float f = getDimension(index, defValue); float f = getDimension(index, defValue); Loading Loading @@ -588,6 +604,10 @@ public final class BridgeTypedArray extends TypedArray { return mContext.getDynamicIdByStyle((StyleResourceValue)resValue); return mContext.getDynamicIdByStyle((StyleResourceValue)resValue); } } if (RenderResources.REFERENCE_NULL.equals(resValue.getValue())) { return defValue; } // if the attribute was a reference to a resource, and not a declaration of an id (@+id), // if the attribute was a reference to a resource, and not a declaration of an id (@+id), // then the xml attribute value was "resolved" which leads us to a ResourceValue with a // then the xml attribute value was "resolved" which leads us to a ResourceValue with a // valid getType() and getName() returning a resource name. // valid getType() and getName() returning a resource name. Loading Loading @@ -715,6 +735,10 @@ public final class BridgeTypedArray extends TypedArray { String value = mResourceData[index].getValue(); String value = mResourceData[index].getValue(); if (value != null) { if (value != null) { if (RenderResources.REFERENCE_NULL.equals(value)) { return null; } return new CharSequence[] { value }; return new CharSequence[] { value }; } } Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -188,6 +188,10 @@ public final class BridgeTypedArray extends TypedArray { String s = mResourceData[index].getValue(); String s = mResourceData[index].getValue(); if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } try { try { return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue); return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue); } catch (NumberFormatException e) { } catch (NumberFormatException e) { Loading Loading @@ -301,6 +305,10 @@ public final class BridgeTypedArray extends TypedArray { return null; return null; } } if (RenderResources.REFERENCE_NULL.equals(value)) { return null; } // let the framework inflate the ColorStateList from the XML file. // let the framework inflate the ColorStateList from the XML file. File f = new File(value); File f = new File(value); if (f.isFile()) { if (f.isFile()) { Loading Loading @@ -408,6 +416,10 @@ public final class BridgeTypedArray extends TypedArray { return LayoutParams.WRAP_CONTENT; return LayoutParams.WRAP_CONTENT; } } if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } if (ResourceHelper.stringToFloat(s, mValue)) { if (ResourceHelper.stringToFloat(s, mValue)) { return mValue.getDimension(mBridgeResources.mMetrics); return mValue.getDimension(mBridgeResources.mMetrics); } } Loading Loading @@ -480,6 +492,10 @@ public final class BridgeTypedArray extends TypedArray { return LayoutParams.WRAP_CONTENT; return LayoutParams.WRAP_CONTENT; } } if (RenderResources.REFERENCE_NULL.equals(s)) { return defValue; } // FIXME huh? // FIXME huh? float f = getDimension(index, defValue); float f = getDimension(index, defValue); Loading Loading @@ -588,6 +604,10 @@ public final class BridgeTypedArray extends TypedArray { return mContext.getDynamicIdByStyle((StyleResourceValue)resValue); return mContext.getDynamicIdByStyle((StyleResourceValue)resValue); } } if (RenderResources.REFERENCE_NULL.equals(resValue.getValue())) { return defValue; } // if the attribute was a reference to a resource, and not a declaration of an id (@+id), // if the attribute was a reference to a resource, and not a declaration of an id (@+id), // then the xml attribute value was "resolved" which leads us to a ResourceValue with a // then the xml attribute value was "resolved" which leads us to a ResourceValue with a // valid getType() and getName() returning a resource name. // valid getType() and getName() returning a resource name. Loading Loading @@ -715,6 +735,10 @@ public final class BridgeTypedArray extends TypedArray { String value = mResourceData[index].getValue(); String value = mResourceData[index].getValue(); if (value != null) { if (value != null) { if (RenderResources.REFERENCE_NULL.equals(value)) { return null; } return new CharSequence[] { value }; return new CharSequence[] { value }; } } Loading