summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-07-29 18:31:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-28 18:28:56 +0000
commit57b69dd27e582e951ea223ba970bd7157753769b (patch)
treecc98f94109e75ad717badde6da43cd355a5f2c10
parent6817337118655d5792e36e954b123e6daa4174a6 (diff)
parent500c56089f7e3e2735a105954a05801025d56921 (diff)
downloadframeworks_base-57b69dd27e582e951ea223ba970bd7157753769b.zip
frameworks_base-57b69dd27e582e951ea223ba970bd7157753769b.tar.gz
frameworks_base-57b69dd27e582e951ea223ba970bd7157753769b.tar.bz2
Merge "Partial revert "Add better errors for unresolved attributes, remove unused code"" into lmp-dev
-rw-r--r--core/java/android/content/res/TypedArray.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index c7773ad..8607bbc 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -709,7 +709,33 @@ public class TypedArray {
}
/**
- * Retrieve the Drawable for the attribute at <var>index</var>.
+ * Retrieve the theme attribute resource identifier for the attribute at
+ * <var>index</var>.
+ *
+ * @param index Index of attribute to retrieve.
+ * @param defValue Value to return if the attribute is not defined or not a
+ * resource.
+ * @return Theme attribute resource identifier, or defValue if not defined.
+ * @hide
+ */
+ public int getThemeAttributeId(int index, int defValue) {
+ if (mRecycled) {
+ throw new RuntimeException("Cannot make calls to a recycled instance!");
+ }
+
+ index *= AssetManager.STYLE_NUM_ENTRIES;
+ final int[] data = mData;
+ if (data[index + AssetManager.STYLE_TYPE] == TypedValue.TYPE_ATTRIBUTE) {
+ return data[index + AssetManager.STYLE_DATA];
+ }
+ return defValue;
+ }
+
+ /**
+ * Retrieve the Drawable for the attribute at <var>index</var>. This
+ * gets the resource ID of the selected attribute, and uses
+ * {@link Resources#getDrawable Resources.getDrawable} of the owning
+ * Resources object to retrieve its Drawable.
*
* @param index Index of attribute to retrieve.
*