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

Commit 8689afbd authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5544103 - Spinner text doesn't look dimmed when disabled" into ics-mr1

parents b9b08257 42b7e99b
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public class Spinner extends AbsSpinner implements OnClickListener {
    int mDropDownWidth;

    private int mGravity;
    private boolean mDisableChildrenWhenDisabled;

    private Rect mTempRect = new Rect();

@@ -186,6 +187,9 @@ public class Spinner extends AbsSpinner implements OnClickListener {

        mPopup.setPromptText(a.getString(com.android.internal.R.styleable.Spinner_prompt));

        mDisableChildrenWhenDisabled = a.getBoolean(
                com.android.internal.R.styleable.Spinner_disableChildrenWhenDisabled, false);

        a.recycle();

        // Base constructor can call setAdapter before we initialize mPopup.
@@ -196,6 +200,17 @@ public class Spinner extends AbsSpinner implements OnClickListener {
        }
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        if (mDisableChildrenWhenDisabled) {
            final int count = getChildCount();
            for (int i = 0; i < count; i++) {
                getChildAt(i).setEnabled(enabled);
            }
        }
    }

    /**
     * Describes how the selected item view is positioned. Currently only the horizontal component
     * is used. The default is determined by the current theme.
@@ -398,6 +413,9 @@ public class Spinner extends AbsSpinner implements OnClickListener {
        addViewInLayout(child, 0, lp);

        child.setSelected(hasFocus());
        if (mDisableChildrenWhenDisabled) {
            child.setEnabled(isEnabled());
        }

        // Get measure specs
        int childHeightSpec = ViewGroup.getChildMeasureSpec(mHeightMeasureSpec,
+3 −0
Original line number Diff line number Diff line
@@ -3331,6 +3331,9 @@
        <attr name="popupPromptView" format="reference" />
        <!-- Gravity setting for positioning the currently selected item. -->
        <attr name="gravity" />
        <!-- Whether this spinner should mark child views as enabled/disabled when
             the spinner itself is enabled/disabled. -->
        <attr name="disableChildrenWhenDisabled" format="boolean" />
    </declare-styleable>

    <declare-styleable name="DatePicker">
+1 −0
Original line number Diff line number Diff line
@@ -1798,6 +1798,7 @@ please see styles_device_defaults.xml.
        <item name="android:dropDownWidth">wrap_content</item>
        <item name="android:popupPromptView">@android:layout/simple_dropdown_hint</item>
        <item name="android:gravity">left|center_vertical</item>
        <item name="android:disableChildrenWhenDisabled">true</item>
    </style>

    <style name="Widget.Holo.Spinner.DropDown">