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

Commit d952abf6 authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

ESPRESSO-823: Removed dialog themes and list item styles.

parent 6499d419
Loading
Loading
Loading
Loading
+1 −12
Original line number Original line Diff line number Diff line
@@ -2494,19 +2494,8 @@ public final class ActivityThread {
                activity.mStartedActivity = false;
                activity.mStartedActivity = false;
                int theme = r.activityInfo.getThemeResource();
                int theme = r.activityInfo.getThemeResource();
                if (theme != 0) {
                if (theme != 0) {
                    // Following is a workaround to have those activity managed dialogs to be themed when the theme flag is on.
                    if (r.activityInfo.isThemeable() && (theme == android.R.style.Theme_Dialog || 
                            theme == com.android.internal.R.style.Theme_Dialog_Alert)) {
                        if (theme == android.R.style.Theme_Dialog) {
                            activity.setTheme(Dialog.resolveDefaultTheme(activity, 0, android.R.styleable.Theme_dialogTheme, 
                                    com.android.internal.R.style.Theme_Dialog));
                        } else if (theme == com.android.internal.R.style.Theme_Dialog_Alert) {
                            activity.setTheme(AlertDialog.resolveDefaultTheme(activity, 0));
                        }
                    } else {
                    activity.setTheme(theme);
                    activity.setTheme(theme);
                }
                }
                }


                activity.mCalled = false;
                activity.mCalled = false;
                mInstrumentation.callActivityOnCreate(activity, r.state);
                mInstrumentation.callActivityOnCreate(activity, r.state);
+15 −23
Original line number Original line Diff line number Diff line
@@ -56,25 +56,19 @@ public class AlertDialog extends Dialog implements DialogInterface {
    private AlertController mAlert;
    private AlertController mAlert;


    protected AlertDialog(Context context) {
    protected AlertDialog(Context context) {
        this(context, 0);
        this(context, com.android.internal.R.style.Theme_Dialog_Alert);
    }
    }


    protected AlertDialog(Context context, int theme) {
    protected AlertDialog(Context context, int theme) {
        super(context, resolveDefaultTheme(context, theme));
        super(context, theme);
        mAlert = new AlertController(getContext(), this, getWindow());
        mAlert = new AlertController(context, this, getWindow());
    }
    }


    protected AlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
    protected AlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, resolveDefaultTheme(context, 0));
        super(context, com.android.internal.R.style.Theme_Dialog_Alert);
        setCancelable(cancelable);
        setCancelable(cancelable);
        setOnCancelListener(cancelListener);
        setOnCancelListener(cancelListener);
        mAlert = new AlertController(getContext(), this, getWindow());
        mAlert = new AlertController(context, this, getWindow());
    }
    
    static int resolveDefaultTheme(Context context, int theme) {
        return Dialog.resolveDefaultTheme(context, theme,
                android.R.styleable.Theme_alertDialogTheme,
                com.android.internal.R.style.Theme_Dialog_Alert);
    }
    }


    /**
    /**
@@ -270,15 +264,13 @@ public class AlertDialog extends Dialog implements DialogInterface {
    }
    }
    
    
    public static class Builder {
    public static class Builder {
        private final Context mContext;
        private final AlertController.AlertParams P;
        private final AlertController.AlertParams P;
        
        
        /**
        /**
         * Constructor using a context for this builder and the {@link AlertDialog} it creates.
         * Constructor using a context for this builder and the {@link AlertDialog} it creates.
         */
         */
        public Builder(Context context) {
        public Builder(Context context) {
            mContext = context;
            P = new AlertController.AlertParams(context);
            P = new AlertController.AlertParams();
        }
        }
        
        
        /**
        /**
@@ -287,7 +279,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setTitle(int titleId) {
        public Builder setTitle(int titleId) {
            P.mTitle = mContext.getText(titleId);
            P.mTitle = P.mContext.getText(titleId);
            return this;
            return this;
        }
        }
        
        
@@ -323,7 +315,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setMessage(int messageId) {
        public Builder setMessage(int messageId) {
            P.mMessage = mContext.getText(messageId);
            P.mMessage = P.mContext.getText(messageId);
            return this;
            return this;
        }
        }
        
        
@@ -365,7 +357,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setPositiveButton(int textId, final OnClickListener listener) {
        public Builder setPositiveButton(int textId, final OnClickListener listener) {
            P.mPositiveButtonText = mContext.getText(textId);
            P.mPositiveButtonText = P.mContext.getText(textId);
            P.mPositiveButtonListener = listener;
            P.mPositiveButtonListener = listener;
            return this;
            return this;
        }
        }
@@ -391,7 +383,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setNegativeButton(int textId, final OnClickListener listener) {
        public Builder setNegativeButton(int textId, final OnClickListener listener) {
            P.mNegativeButtonText = mContext.getText(textId);
            P.mNegativeButtonText = P.mContext.getText(textId);
            P.mNegativeButtonListener = listener;
            P.mNegativeButtonListener = listener;
            return this;
            return this;
        }
        }
@@ -417,7 +409,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setNeutralButton(int textId, final OnClickListener listener) {
        public Builder setNeutralButton(int textId, final OnClickListener listener) {
            P.mNeutralButtonText = mContext.getText(textId);
            P.mNeutralButtonText = P.mContext.getText(textId);
            P.mNeutralButtonListener = listener;
            P.mNeutralButtonListener = listener;
            return this;
            return this;
        }
        }
@@ -473,7 +465,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * @return This Builder object to allow for chaining of calls to set methods
         * @return This Builder object to allow for chaining of calls to set methods
         */
         */
        public Builder setItems(int itemsId, final OnClickListener listener) {
        public Builder setItems(int itemsId, final OnClickListener listener) {
            P.mItems = mContext.getResources().getTextArray(itemsId);
            P.mItems = P.mContext.getResources().getTextArray(itemsId);
            P.mOnClickListener = listener;
            P.mOnClickListener = listener;
            return this;
            return this;
        }
        }
@@ -546,7 +538,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         */
         */
        public Builder setMultiChoiceItems(int itemsId, boolean[] checkedItems, 
        public Builder setMultiChoiceItems(int itemsId, boolean[] checkedItems, 
                final OnMultiChoiceClickListener listener) {
                final OnMultiChoiceClickListener listener) {
            P.mItems = mContext.getResources().getTextArray(itemsId);
            P.mItems = P.mContext.getResources().getTextArray(itemsId);
            P.mOnCheckboxClickListener = listener;
            P.mOnCheckboxClickListener = listener;
            P.mCheckedItems = checkedItems;
            P.mCheckedItems = checkedItems;
            P.mIsMultiChoice = true;
            P.mIsMultiChoice = true;
@@ -625,7 +617,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         */
         */
        public Builder setSingleChoiceItems(int itemsId, int checkedItem, 
        public Builder setSingleChoiceItems(int itemsId, int checkedItem, 
                final OnClickListener listener) {
                final OnClickListener listener) {
            P.mItems = mContext.getResources().getTextArray(itemsId);
            P.mItems = P.mContext.getResources().getTextArray(itemsId);
            P.mOnClickListener = listener;
            P.mOnClickListener = listener;
            P.mCheckedItem = checkedItem;
            P.mCheckedItem = checkedItem;
            P.mIsSingleChoice = true;
            P.mIsSingleChoice = true;
@@ -791,7 +783,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
         * to do and want this to be created and displayed.
         * to do and want this to be created and displayed.
         */
         */
        public AlertDialog create() {
        public AlertDialog create() {
            final AlertDialog dialog = new AlertDialog(mContext);
            final AlertDialog dialog = new AlertDialog(P.mContext);
            P.apply(dialog.mAlert);
            P.apply(dialog.mAlert);
            dialog.setCancelable(P.mCancelable);
            dialog.setCancelable(P.mCancelable);
            dialog.setOnCancelListener(P.mOnCancelListener);
            dialog.setOnCancelListener(P.mOnCancelListener);
+1 −1
Original line number Original line Diff line number Diff line
@@ -80,7 +80,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
            int year,
            int year,
            int monthOfYear,
            int monthOfYear,
            int dayOfMonth) {
            int dayOfMonth) {
        this(context, 0, 
        this(context, com.android.internal.R.style.Theme_Dialog_Alert, 
                callBack, year, monthOfYear, dayOfMonth);
                callBack, year, monthOfYear, dayOfMonth);
    }
    }


+2 −21
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.ContextWrapper;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
@@ -135,9 +134,8 @@ public class Dialog implements DialogInterface, Window.Callback,
     * <var>context</var>.  If 0, the default dialog theme will be used.
     * <var>context</var>.  If 0, the default dialog theme will be used.
     */
     */
    public Dialog(Context context, int theme) {
    public Dialog(Context context, int theme) {
        mContext = new ContextThemeWrapper(context,
        mContext = new ContextThemeWrapper(
                resolveDefaultTheme(context, theme, android.R.styleable.Theme_dialogTheme, 
            context, theme == 0 ? com.android.internal.R.style.Theme_Dialog : theme);
                        com.android.internal.R.style.Theme_Dialog));
        mWindowManager = (WindowManager)context.getSystemService("window");
        mWindowManager = (WindowManager)context.getSystemService("window");
        Window w = PolicyManager.makeNewWindow(mContext);
        Window w = PolicyManager.makeNewWindow(mContext);
        mWindow = w;
        mWindow = w;
@@ -148,23 +146,6 @@ public class Dialog implements DialogInterface, Window.Callback,
        mListenersHandler = new ListenersHandler(this);
        mListenersHandler = new ListenersHandler(this);
    }
    }


    /**
     * This method is provided to work around the constructor pattern limitation
     * present in Dialog. We must resolve theme==0 to the runtime specified
     * theme, but this cannot be done by subclasses except through this method.
     */
    static int resolveDefaultTheme(Context context, int theme, int themeAttrIndex,
            int staticDefault) {
        if (theme != 0) {
            return theme;
        } else {
            TypedArray a = context.obtainStyledAttributes(android.R.styleable.Theme);
            int newTheme = a.getResourceId(themeAttrIndex, staticDefault);
            a.recycle();
            return newTheme;
        }
    }

    /**
    /**
     * @deprecated
     * @deprecated
     * @hide
     * @hide
+3 −3
Original line number Original line Diff line number Diff line
@@ -73,11 +73,11 @@ public class ProgressDialog extends AlertDialog {
    private Handler mViewUpdateHandler;
    private Handler mViewUpdateHandler;
    
    
    public ProgressDialog(Context context) {
    public ProgressDialog(Context context) {
        this(context, 0);
        this(context, com.android.internal.R.style.Theme_Dialog_Alert);
    }
    }


    public ProgressDialog(Context context, int theme) {
    public ProgressDialog(Context context, int theme) {
        super(context, resolveDefaultTheme(context, theme));
        super(context, theme);
    }
    }


    public static ProgressDialog show(Context context, CharSequence title,
    public static ProgressDialog show(Context context, CharSequence title,
Loading