summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-07-13 14:53:54 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-07-13 14:53:54 -0700
commit37b3cc3bbe33df61f227bcf253aa67a4be441233 (patch)
treea8886da36bc5f28705379761e7912f62d2ae5b58 /tools/layoutlib
parentfd909a774cb384b139c5e360cadb2681c3f48c29 (diff)
parent9163a4a686fc25fefc77d5b41c24a4538486a48e (diff)
downloadframeworks_base-37b3cc3bbe33df61f227bcf253aa67a4be441233.zip
frameworks_base-37b3cc3bbe33df61f227bcf253aa67a4be441233.tar.gz
frameworks_base-37b3cc3bbe33df61f227bcf253aa67a4be441233.tar.bz2
am 9163a4a6: am aa4b1d8b: am d292d2a0: Merge 36a3a392 from mr1.
* commit '9163a4a686fc25fefc77d5b41c24a4538486a48e': Merge 36a3a392 from mr1.
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java60
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;
}