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

Commit b17c6c17 authored by Alan Viverette's avatar Alan Viverette
Browse files

Only use default backgrounds when not extending AlertDialog style

BUG: 17368867
Change-Id: I440dad33cfb093c13b450a5f2369481fb30665ad
parent b10e39e7
Loading
Loading
Loading
Loading
+58 −95
Original line number Diff line number Diff line
@@ -65,55 +65,38 @@ public class AlertController {
    private final Window mWindow;

    private CharSequence mTitle;

    private CharSequence mMessage;

    private ListView mListView;
    
    private View mView;

    private int mViewLayoutResId;

    private int mViewSpacingLeft;
    
    private int mViewSpacingTop;
    
    private int mViewSpacingRight;
    
    private int mViewSpacingBottom;
    
    private boolean mViewSpacingSpecified = false;

    private Button mButtonPositive;

    private CharSequence mButtonPositiveText;

    private Message mButtonPositiveMessage;

    private Button mButtonNegative;

    private CharSequence mButtonNegativeText;

    private Message mButtonNegativeMessage;

    private Button mButtonNeutral;

    private CharSequence mButtonNeutralText;

    private Message mButtonNeutralMessage;

    private ScrollView mScrollView;

    private int mIconId = 0;
    
    private Drawable mIcon;

    private ImageView mIconView;
    
    private TextView mTitleView;

    private TextView mMessageView;

    private View mCustomTitleView;

    private boolean mForceInverseBackground;
@@ -694,7 +677,12 @@ public class AlertController {
        int centerBright = 0;
        int bottomBright = 0;
        int bottomMedium = 0;
        if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.KITKAT) {

        // If the needsDefaultBackgrounds attribute is set, we know we're
        // inheriting from a framework style.
        final boolean needsDefaultBackgrounds = a.getBoolean(
                R.styleable.AlertDialog_needsDefaultBackgrounds, true);
        if (needsDefaultBackgrounds) {
            fullDark = R.drawable.popup_full_dark;
            topDark = R.drawable.popup_top_dark;
            centerDark = R.drawable.popup_center_dark;
@@ -705,12 +693,12 @@ public class AlertController {
            bottomBright = R.drawable.popup_bottom_bright;
            bottomMedium = R.drawable.popup_bottom_medium;
        }

        topBright = a.getResourceId(R.styleable.AlertDialog_topBright, topBright);
        topDark = a.getResourceId(R.styleable.AlertDialog_topDark, topDark);
        centerBright = a.getResourceId(R.styleable.AlertDialog_centerBright, centerBright);
        centerDark = a.getResourceId(R.styleable.AlertDialog_centerDark, centerDark);


        /* We now set the background of all of the sections of the alert.
         * First collect together each section that is being displayed along
         * with whether it is on a light or dark background, then run through
@@ -789,31 +777,6 @@ public class AlertController {
            }
        }

        /* TODO: uncomment section below. The logic for this should be if 
         * it's a Contextual menu being displayed AND only a Cancel button 
         * is shown then do this.
         */
//        if (hasButtons && (mListView != null)) {
            
            /* Yet another *special* case. If there is a ListView with buttons
             * don't put the buttons on the bottom but instead put them in the
             * footer of the ListView this will allow more items to be
             * displayed.
             */
            
            /*
            contentPanel.setBackgroundResource(bottomBright);
            buttonPanel.setBackgroundResource(centerMedium);
            ViewGroup parent = (ViewGroup) mWindow.findViewById(R.id.parentPanel);
            parent.removeView(buttonPanel);
            AbsListView.LayoutParams params = new AbsListView.LayoutParams(
                    AbsListView.LayoutParams.MATCH_PARENT, 
                    AbsListView.LayoutParams.MATCH_PARENT);
            buttonPanel.setLayoutParams(params);
            mListView.addFooterView(buttonPanel);
            */
//        }

        final ListView listView = mListView;
        if (listView != null && mAdapter != null) {
            listView.setAdapter(mAdapter);
+2 −0
Original line number Diff line number Diff line
@@ -1949,6 +1949,8 @@
        <attr name="listItemLayout" format="reference" />
        <attr name="progressLayout" format="reference" />
        <attr name="horizontalProgressLayout" format="reference" />
        <!-- @hide Whether fullDark, etc. should use default values if null. -->
        <attr name="needsDefaultBackgrounds" format="boolean" />
    </declare-styleable>

    <!-- Fragment animation class attributes. -->
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ please see styles_device_defaults.xml.
        <item name="centerMedium">@drawable/popup_center_medium</item>
        <item name="progressLayout">@layout/progress_dialog</item>
        <item name="horizontalProgressLayout">@layout/alert_dialog_progress</item>
        <item name="needsDefaultBackgrounds">false</item>
    </style>

    <style name="Widget.PreferenceFrameLayout">