diff options
| author | 2014-04-01 17:51:48 +0000 | |
|---|---|---|
| committer | 2014-04-01 17:51:48 +0000 | |
| commit | 1dbede1c79299b49cc590134ea8486fc90c7540f (patch) | |
| tree | 81407510e880ca6079ef98764e0a7589ad612382 | |
| parent | 5c2f20394edfb2c89d88d51772717b8f61a50f60 (diff) | |
| parent | 831f3ce9b5b330101b090daf3163a843e0c6317e (diff) | |
Merge "Add stub getThemeAttributeId() to BridgeTypedArray"
| -rw-r--r-- | tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java index cfe7525ead3a..cc621c431372 100644 --- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java @@ -52,9 +52,9 @@ public final class BridgeTypedArray extends TypedArray { private final BridgeContext mContext; private final boolean mPlatformFile; - private ResourceValue[] mResourceData; - private String[] mNames; - private boolean[] mIsFramework; + private final ResourceValue[] mResourceData; + private final String[] mNames; + private final boolean[] mIsFramework; public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len, boolean platformFile) { @@ -81,8 +81,8 @@ public final class BridgeTypedArray extends TypedArray { } /** - * Seals the array after all calls to {@link #bridgeSetValue(int, String, ResourceValue)} have - * been done. + * Seals the array after all calls to + * {@link #bridgeSetValue(int, String, boolean, ResourceValue)} have been done. * <p/>This allows to compute the list of non default values, permitting * {@link #getIndexCount()} to return the proper value. */ @@ -252,7 +252,7 @@ public final class BridgeTypedArray extends TypedArray { for (String keyword : keywords) { Integer i = map.get(keyword.trim()); if (i != null) { - result |= i.intValue(); + result |= i; } else { Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT, String.format( @@ -731,7 +731,7 @@ public final class BridgeTypedArray extends TypedArray { } // not a direct id valid reference? resolve it - Integer idValue = null; + Integer idValue; if (resValue.isFramework()) { idValue = Bridge.getResourceId(resValue.getResourceType(), @@ -742,7 +742,7 @@ public final class BridgeTypedArray extends TypedArray { } if (idValue != null) { - return idValue.intValue(); + return idValue; } Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE, @@ -753,6 +753,12 @@ public final class BridgeTypedArray extends TypedArray { return defValue; } + @Override + public int getThemeAttributeId(int index, int defValue) { + // TODO: Get the right Theme Attribute ID to enable caching of the drawables. + return defValue; + } + /** * Retrieve the Drawable for the attribute at <var>index</var>. This * gets the resource ID of the selected attribute, and uses @@ -854,6 +860,7 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public boolean hasValue(int index) { + //noinspection SimplifiableIfStatement if (index < 0 || index >= mResourceData.length) { return false; } |