File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
core/java/com/android/internal/app Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,18 @@ public void setIcon(Drawable icon) {
347347 }
348348 }
349349
350+ /**
351+ * @param attrId the attributeId of the theme-specific drawable
352+ * to resolve the resourceId for.
353+ *
354+ * @return resId the resourceId of the theme-specific drawable
355+ */
356+ public int getIconAttributeResId (int attrId ) {
357+ TypedValue out = new TypedValue ();
358+ mContext .getTheme ().resolveAttribute (attrId , out , true );
359+ return out .resourceId ;
360+ }
361+
350362 public void setInverseBackgroundForced (boolean forceInverseBackground ) {
351363 mForceInverseBackground = forceInverseBackground ;
352364 }
@@ -740,6 +752,7 @@ public static class AlertParams {
740752
741753 public int mIconId = 0 ;
742754 public Drawable mIcon ;
755+ public int mIconAttrId = 0 ;
743756 public CharSequence mTitle ;
744757 public View mCustomTitleView ;
745758 public CharSequence mMessage ;
@@ -806,6 +819,9 @@ public void apply(AlertController dialog) {
806819 if (mIconId >= 0 ) {
807820 dialog .setIcon (mIconId );
808821 }
822+ if (mIconAttrId > 0 ) {
823+ dialog .setIcon (dialog .getIconAttributeResId (mIconAttrId ));
824+ }
809825 }
810826 if (mMessage != null ) {
811827 dialog .setMessage (mMessage );
You can’t perform that action at this time.
0 commit comments