Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6de1301b authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 947f7824: Fix bug 3245465 - Themed dialog icons

* commit '947f7824':
  Fix bug 3245465 - Themed dialog icons
parents 4bc6bb85 947f7824
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -2116,6 +2116,17 @@
 visibility="public"
>
</field>
<field name="alertDialogIcon"
 type="int"
 transient="false"
 volatile="false"
 value="16843607"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="alertDialogStyle"
 type="int"
 transient="false"
@@ -26610,6 +26621,19 @@
<parameter name="icon" type="android.graphics.drawable.Drawable">
</parameter>
</method>
<method name="setIconAttribute"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="attrId" type="int">
</parameter>
</method>
<method name="setInverseBackgroundForced"
 return="void"
 abstract="false"
@@ -26807,6 +26831,19 @@
<parameter name="icon" type="android.graphics.drawable.Drawable">
</parameter>
</method>
<method name="setIconAttribute"
 return="android.app.AlertDialog.Builder"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="attrId" type="int">
</parameter>
</method>
<method name="setInverseBackgroundForced"
 return="android.app.AlertDialog.Builder"
 abstract="false"
+24 −1
Original line number Diff line number Diff line
@@ -270,6 +270,17 @@ public class AlertDialog extends Dialog implements DialogInterface {
        mAlert.setIcon(icon);
    }

    /**
     * Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon
     *
     * @param attrId ID of a theme attribute that points to a drawable resource.
     */
    public void setIconAttribute(int attrId) {
        TypedValue out = new TypedValue();
        mContext.getTheme().resolveAttribute(attrId, out, true);
        mAlert.setIcon(out.resourceId);
    }

    public void setInverseBackgroundForced(boolean forceInverseBackground) {
        mAlert.setInverseBackgroundForced(forceInverseBackground);
    }
@@ -400,6 +411,18 @@ public class AlertDialog extends Dialog implements DialogInterface {
            return this;
        }

        /**
         * Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon
         *
         * @param attrId ID of a theme attribute that points to a drawable resource.
         */
        public Builder setIconAttribute(int attrId) {
            TypedValue out = new TypedValue();
            P.mContext.getTheme().resolveAttribute(attrId, out, true);
            P.mIconId = out.resourceId;
            return this;
        }

        /**
         * Set a listener to be invoked when the positive button of the dialog is pressed.
         * @param textId The resource id of the text to display in the positive button
+4 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
@@ -84,8 +85,10 @@ public class HeavyWeightSwitcherActivity extends Activity {
        button = findViewById((R.id.cancel));
        button.setOnClickListener(mCancelListener);
        
        TypedValue out = new TypedValue();
        getTheme().resolveAttribute(android.R.attr.alertDialogIcon, out, true);
        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, 
                android.R.drawable.ic_dialog_alert);
                out.resourceId);
    }

    void setText(int id, CharSequence text) {
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public final class ShutdownThread extends Thread {
        if (confirm) {
            final CloseDialogReceiver closer = new CloseDialogReceiver(context);
            final AlertDialog dialog = new AlertDialog.Builder(context)
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setIconAttribute(android.R.attr.alertDialogIcon)
                    .setTitle(com.android.internal.R.string.power_off)
                    .setMessage(resourceId)
                    .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
+930 B
Loading image diff...
Loading