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

Commit 6e90a362 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 5159736 - Make DeviceDefault the default

Have the framework refer to the DeviceDefault themes for ICS apps that
don't explicitly request another theme.

Change-Id: I27dd0bbaa60f71df4f36e47d260f556d923ba075
parent 52727fc3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2853,6 +2853,8 @@ package android.app {
    method public void setMessage(java.lang.CharSequence);
    method public void setView(android.view.View);
    method public void setView(android.view.View, int, int, int, int);
    field public static final int THEME_DEVICE_DEFAULT_DARK = 4; // 0x4
    field public static final int THEME_DEVICE_DEFAULT_LIGHT = 5; // 0x5
    field public static final int THEME_HOLO_DARK = 2; // 0x2
    field public static final int THEME_HOLO_LIGHT = 3; // 0x3
    field public static final int THEME_TRADITIONAL = 1; // 0x1
+16 −0
Original line number Diff line number Diff line
@@ -76,6 +76,18 @@ public class AlertDialog extends Dialog implements DialogInterface {
     */
    public static final int THEME_HOLO_LIGHT = 3;

    /**
     * Special theme constant for {@link #AlertDialog(Context, int)}: use
     * the device's default alert theme with a dark background.
     */
    public static final int THEME_DEVICE_DEFAULT_DARK = 4;

    /**
     * Special theme constant for {@link #AlertDialog(Context, int)}: use
     * the device's default alert theme with a dark background.
     */
    public static final int THEME_DEVICE_DEFAULT_LIGHT = 5;
    
    protected AlertDialog(Context context) {
        this(context, resolveDialogTheme(context, 0), true);
    }
@@ -113,6 +125,10 @@ public class AlertDialog extends Dialog implements DialogInterface {
            return com.android.internal.R.style.Theme_Holo_Dialog_Alert;
        } else if (resid == THEME_HOLO_LIGHT) {
            return com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert;
        } else if (resid == THEME_DEVICE_DEFAULT_DARK) {
            return com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert;
        } else if (resid == THEME_DEVICE_DEFAULT_LIGHT) {
            return com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert;
        } else if (resid >= 0x01000000) {   // start of real resource IDs.
            return resid;
        } else {
+2 −1
Original line number Diff line number Diff line
@@ -364,7 +364,8 @@ class ContextImpl extends Context {
                                Resources.selectSystemTheme(0,
                                        outerContext.getApplicationInfo().targetSdkVersion,
                                        com.android.internal.R.style.Theme_Dialog,
                                        com.android.internal.R.style.Theme_Holo_Dialog)),
                                        com.android.internal.R.style.Theme_Holo_Dialog,
                                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
                        ctx.mMainThread.getHandler());
                }});

+1 −1
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ public class DialogFragment extends Fragment
    public void setStyle(int style, int theme) {
        mStyle = style;
        if (mStyle == STYLE_NO_FRAME || mStyle == STYLE_NO_INPUT) {
            mTheme = com.android.internal.R.style.Theme_Holo_Dialog_NoFrame;
            mTheme = com.android.internal.R.style.Theme_DeviceDefault_Dialog_NoFrame;
        }
        if (theme != 0) {
            mTheme = theme;
+9 −3
Original line number Diff line number Diff line
@@ -134,19 +134,25 @@ public class Resources {
    /** @hide */
    public static int selectDefaultTheme(int curTheme, int targetSdkVersion) {
        return selectSystemTheme(curTheme, targetSdkVersion,
                com.android.internal.R.style.Theme, com.android.internal.R.style.Theme_Holo);
                com.android.internal.R.style.Theme,
                com.android.internal.R.style.Theme_Holo,
                com.android.internal.R.style.Theme_DeviceDefault);
    }
    
    /** @hide */
    public static int selectSystemTheme(int curTheme, int targetSdkVersion, int orig, int holo) {
    public static int selectSystemTheme(int curTheme, int targetSdkVersion,
            int orig, int holo, int deviceDefault) {
        if (curTheme != 0) {
            return curTheme;
        }
        if (targetSdkVersion < Build.VERSION_CODES.HONEYCOMB) {
            return orig;
        }
        if (targetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            return holo;
        }
        return deviceDefault;
    }
    
    /**
     * This exception is thrown by the resource APIs when a requested resource
Loading