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

Commit 98a31b2e authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Only use default backgrounds when not extending AlertDialog style" into lmp-dev

parents cf39f86b b17c6c17
Loading
Loading
Loading
Loading
+58 −95
Original line number Original line Diff line number Diff line
@@ -65,55 +65,38 @@ public class AlertController {
    private final Window mWindow;
    private final Window mWindow;


    private CharSequence mTitle;
    private CharSequence mTitle;

    private CharSequence mMessage;
    private CharSequence mMessage;

    private ListView mListView;
    private ListView mListView;
    
    private View mView;
    private View mView;


    private int mViewLayoutResId;
    private int mViewLayoutResId;


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


    private Button mButtonPositive;
    private Button mButtonPositive;

    private CharSequence mButtonPositiveText;
    private CharSequence mButtonPositiveText;

    private Message mButtonPositiveMessage;
    private Message mButtonPositiveMessage;


    private Button mButtonNegative;
    private Button mButtonNegative;

    private CharSequence mButtonNegativeText;
    private CharSequence mButtonNegativeText;

    private Message mButtonNegativeMessage;
    private Message mButtonNegativeMessage;


    private Button mButtonNeutral;
    private Button mButtonNeutral;

    private CharSequence mButtonNeutralText;
    private CharSequence mButtonNeutralText;

    private Message mButtonNeutralMessage;
    private Message mButtonNeutralMessage;


    private ScrollView mScrollView;
    private ScrollView mScrollView;


    private int mIconId = 0;
    private int mIconId = 0;
    
    private Drawable mIcon;
    private Drawable mIcon;


    private ImageView mIconView;
    private ImageView mIconView;
    
    private TextView mTitleView;
    private TextView mTitleView;

    private TextView mMessageView;
    private TextView mMessageView;

    private View mCustomTitleView;
    private View mCustomTitleView;


    private boolean mForceInverseBackground;
    private boolean mForceInverseBackground;
@@ -694,7 +677,12 @@ public class AlertController {
        int centerBright = 0;
        int centerBright = 0;
        int bottomBright = 0;
        int bottomBright = 0;
        int bottomMedium = 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;
            fullDark = R.drawable.popup_full_dark;
            topDark = R.drawable.popup_top_dark;
            topDark = R.drawable.popup_top_dark;
            centerDark = R.drawable.popup_center_dark;
            centerDark = R.drawable.popup_center_dark;
@@ -705,12 +693,12 @@ public class AlertController {
            bottomBright = R.drawable.popup_bottom_bright;
            bottomBright = R.drawable.popup_bottom_bright;
            bottomMedium = R.drawable.popup_bottom_medium;
            bottomMedium = R.drawable.popup_bottom_medium;
        }
        }

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



        /* We now set the background of all of the sections of the alert.
        /* We now set the background of all of the sections of the alert.
         * First collect together each section that is being displayed along
         * First collect together each section that is being displayed along
         * with whether it is on a light or dark background, then run through
         * 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;
        final ListView listView = mListView;
        if (listView != null && mAdapter != null) {
        if (listView != null && mAdapter != null) {
            listView.setAdapter(mAdapter);
            listView.setAdapter(mAdapter);
+2 −0
Original line number Original line Diff line number Diff line
@@ -1949,6 +1949,8 @@
        <attr name="listItemLayout" format="reference" />
        <attr name="listItemLayout" format="reference" />
        <attr name="progressLayout" format="reference" />
        <attr name="progressLayout" format="reference" />
        <attr name="horizontalProgressLayout" format="reference" />
        <attr name="horizontalProgressLayout" format="reference" />
        <!-- @hide Whether fullDark, etc. should use default values if null. -->
        <attr name="needsDefaultBackgrounds" format="boolean" />
    </declare-styleable>
    </declare-styleable>


    <!-- Fragment animation class attributes. -->
    <!-- Fragment animation class attributes. -->
+1 −0
Original line number Original line 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="centerMedium">@drawable/popup_center_medium</item>
        <item name="progressLayout">@layout/progress_dialog</item>
        <item name="progressLayout">@layout/progress_dialog</item>
        <item name="horizontalProgressLayout">@layout/alert_dialog_progress</item>
        <item name="horizontalProgressLayout">@layout/alert_dialog_progress</item>
        <item name="needsDefaultBackgrounds">false</item>
    </style>
    </style>


    <style name="Widget.PreferenceFrameLayout">
    <style name="Widget.PreferenceFrameLayout">