diff options
author | Xavier Ducrohet <xav@android.com> | 2011-07-11 12:43:15 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-07-11 12:43:15 -0700 |
commit | aa4b1d8ba9d5e317b67638b764d92d17fb810aa0 (patch) | |
tree | 77623c86fb434d14b42a3d6efe10d12dec49d991 | |
parent | 4821d3bdf8ce35408c6a10fe45c39a5e701ea8e2 (diff) | |
parent | d292d2a03134eaca8b51b6313610b4b78de53c83 (diff) | |
download | frameworks_base-aa4b1d8ba9d5e317b67638b764d92d17fb810aa0.zip frameworks_base-aa4b1d8ba9d5e317b67638b764d92d17fb810aa0.tar.gz frameworks_base-aa4b1d8ba9d5e317b67638b764d92d17fb810aa0.tar.bz2 |
am d292d2a0: Merge 36a3a392 from mr1.
* commit 'd292d2a03134eaca8b51b6313610b4b78de53c83':
Merge 36a3a392 from mr1.
-rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java index 260cdc8..fc2f2f8 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java @@ -131,6 +131,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public CharSequence getText(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (mResourceData[index] != null) { // FIXME: handle styled strings! return mResourceData[index].getValue(); @@ -149,6 +153,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public String getString(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (mResourceData[index] != null) { return mResourceData[index].getValue(); } @@ -166,6 +174,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public boolean getBoolean(int index, boolean defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -188,6 +200,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public int getInt(int index, int defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -252,6 +268,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public float getFloat(int index, float defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -287,6 +307,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public int getColor(int index, int defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -311,6 +335,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public ColorStateList getColorStateList(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (mResourceData[index] == null) { return null; } @@ -395,6 +423,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public float getDimension(int index, float defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -568,6 +600,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public float getFraction(int index, int base, int pbase, float defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + if (mResourceData[index] == null) { return defValue; } @@ -607,6 +643,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public int getResourceId(int index, int defValue) { + if (index < 0 || index >= mResourceData.length) { + return defValue; + } + // get the Resource for this index ResourceValue resValue = mResourceData[index]; @@ -718,6 +758,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public Drawable getDrawable(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (mResourceData[index] == null) { return null; } @@ -744,6 +788,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public CharSequence[] getTextArray(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (mResourceData[index] == null) { return null; } @@ -776,6 +824,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public boolean getValue(int index, TypedValue outValue) { + if (index < 0 || index >= mResourceData.length) { + return false; + } + if (mResourceData[index] == null) { return false; } @@ -795,6 +847,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public boolean hasValue(int index) { + if (index < 0 || index >= mResourceData.length) { + return false; + } + return mResourceData[index] != null; } @@ -811,6 +867,10 @@ public final class BridgeTypedArray extends TypedArray { */ @Override public TypedValue peekValue(int index) { + if (index < 0 || index >= mResourceData.length) { + return null; + } + if (getValue(index, mValue)) { return mValue; } |