summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Powell <adamp@android.com> 2012-09-19 11:56:40 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2012-09-19 11:56:40 -0700
commit56fd88d87ff607f65a963b5500b27ae3d4d2670e (patch)
tree5156f27887d3fe24b6f72493dd7b4de3a1124398
parent945080b5b61e28bfc05c75ba5b2030d1e43d0f19 (diff)
parentab12f0f72c22143523e2bce7d58d9f1021abde5c (diff)
am ab12f0f7: Merge "Implement resolving of icon attributes to resIds in AlertController"
* commit 'ab12f0f72c22143523e2bce7d58d9f1021abde5c': Implement resolving of icon attributes to resIds in AlertController
-rw-r--r--core/java/com/android/internal/app/AlertController.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java
index 2061c905ebb0..56b5937a0dea 100644
--- a/core/java/com/android/internal/app/AlertController.java
+++ b/core/java/com/android/internal/app/AlertController.java
@@ -347,6 +347,18 @@ public class AlertController {
}
}
+ /**
+ * @param attrId the attributeId of the theme-specific drawable
+ * to resolve the resourceId for.
+ *
+ * @return resId the resourceId of the theme-specific drawable
+ */
+ public int getIconAttributeResId(int attrId) {
+ TypedValue out = new TypedValue();
+ mContext.getTheme().resolveAttribute(attrId, out, true);
+ return out.resourceId;
+ }
+
public void setInverseBackgroundForced(boolean forceInverseBackground) {
mForceInverseBackground = forceInverseBackground;
}
@@ -740,6 +752,7 @@ public class AlertController {
public int mIconId = 0;
public Drawable mIcon;
+ public int mIconAttrId = 0;
public CharSequence mTitle;
public View mCustomTitleView;
public CharSequence mMessage;
@@ -806,6 +819,9 @@ public class AlertController {
if (mIconId >= 0) {
dialog.setIcon(mIconId);
}
+ if (mIconAttrId > 0) {
+ dialog.setIcon(dialog.getIconAttributeResId(mIconAttrId));
+ }
}
if (mMessage != null) {
dialog.setMessage(mMessage);