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

Commit 52c10554 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Revert "Revamp of the NumberPicker widget.""

parents 485932f6 efd1c677
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26958,6 +26958,7 @@ package android.widget {
    method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener);
    method public void setValue(int);
    method public void setWrapSelectorWheel(boolean);
    field public static final int SELECTOR_WHEEL_ITEM_COUNT = 5; // 0x5
  }
  public static abstract interface NumberPicker.Formatter {
+14 −0
Original line number Diff line number Diff line
@@ -2679,6 +2679,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        return child.draw(canvas, this, drawingTime);
    }

    @Override
    public void requestLayout() {
        if (mChildrenCount > 0 && getAccessibilityNodeProvider() != null) {
            throw new IllegalStateException("Views with AccessibilityNodeProvider"
                    + " can't have children.");
        }
        super.requestLayout();
    }

    /**
     * 
     * @param enabled True if children should be drawn with layers, false otherwise.
@@ -3100,6 +3109,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    private void addViewInner(View child, int index, LayoutParams params,
            boolean preventRequestLayout) {

        if (getAccessibilityNodeProvider() != null) {
            throw new IllegalStateException("Views with AccessibilityNodeProvider"
                    + " can't have children.");
        }

        if (mTransition != null) {
            // Don't prevent other add transitions from completing, but cancel remove
            // transitions to let them complete the process before we add to the container
+16 −21
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
@@ -280,8 +280,10 @@ public class DatePicker extends FrameLayout {
        reorderSpinners();

        // set content descriptions
        if (AccessibilityManager.getInstance(mContext).isEnabled()) {
            setContentDescriptions();
        }
    }

    /**
     * Gets the minimal date supported by this {@link DatePicker} in
@@ -715,27 +717,20 @@ public class DatePicker extends FrameLayout {

    private void setContentDescriptions() {
        // Day
        trySetContentDescription(mDaySpinner, R.id.increment,
                R.string.date_picker_increment_day_button);
        trySetContentDescription(mDaySpinner, R.id.decrement,
                R.string.date_picker_decrement_day_button);
        String text = mContext.getString(R.string.date_picker_increment_day_button);
        mDaySpinner.findViewById(R.id.increment).setContentDescription(text);
        text = mContext.getString(R.string.date_picker_decrement_day_button);
        mDaySpinner.findViewById(R.id.decrement).setContentDescription(text);
        // Month
        trySetContentDescription(mMonthSpinner, R.id.increment,
                R.string.date_picker_increment_month_button);
        trySetContentDescription(mMonthSpinner, R.id.decrement,
                R.string.date_picker_decrement_month_button);
        text = mContext.getString(R.string.date_picker_increment_month_button);
        mMonthSpinner.findViewById(R.id.increment).setContentDescription(text);
        text = mContext.getString(R.string.date_picker_decrement_month_button);
        mMonthSpinner.findViewById(R.id.decrement).setContentDescription(text);
        // Year
        trySetContentDescription(mYearSpinner, R.id.increment,
                R.string.date_picker_increment_year_button);
        trySetContentDescription(mYearSpinner, R.id.decrement,
                R.string.date_picker_decrement_year_button);
    }

    private void trySetContentDescription(View root, int viewId, int contDescResId) {
        View target = root.findViewById(viewId);
        if (target != null) {
            target.setContentDescription(mContext.getString(contDescResId));
        }
        text = mContext.getString(R.string.date_picker_increment_year_button);
        mYearSpinner.findViewById(R.id.increment).setContentDescription(text);
        text = mContext.getString(R.string.date_picker_decrement_year_button);
        mYearSpinner.findViewById(R.id.decrement).setContentDescription(text);
    }

    private void updateInputState() {
+577 −723

File changed.

Preview size limit exceeded, changes collapsed.

+12 −19
Original line number Diff line number Diff line
@@ -532,28 +532,21 @@ public class TimePicker extends FrameLayout {

    private void setContentDescriptions() {
        // Minute
        trySetContentDescription(mMinuteSpinner, R.id.increment,
                R.string.time_picker_increment_minute_button);
        trySetContentDescription(mMinuteSpinner, R.id.decrement,
                R.string.time_picker_decrement_minute_button);
        String text = mContext.getString(R.string.time_picker_increment_minute_button);
        mMinuteSpinner.findViewById(R.id.increment).setContentDescription(text);
        text = mContext.getString(R.string.time_picker_decrement_minute_button);
        mMinuteSpinner.findViewById(R.id.decrement).setContentDescription(text);
        // Hour
        trySetContentDescription(mHourSpinner, R.id.increment,
                R.string.time_picker_increment_hour_button);
        trySetContentDescription(mHourSpinner, R.id.decrement,
                R.string.time_picker_decrement_hour_button);
        text = mContext.getString(R.string.time_picker_increment_hour_button);
        mHourSpinner.findViewById(R.id.increment).setContentDescription(text);
        text = mContext.getString(R.string.time_picker_decrement_hour_button);
        mHourSpinner.findViewById(R.id.decrement).setContentDescription(text);
        // AM/PM
        if (mAmPmSpinner != null) {
            trySetContentDescription(mAmPmSpinner, R.id.increment,
                    R.string.time_picker_increment_set_pm_button);
            trySetContentDescription(mAmPmSpinner, R.id.decrement,
                    R.string.time_picker_decrement_set_am_button);
        }
    }

    private void trySetContentDescription(View root, int viewId, int contDescResId) {
        View target = root.findViewById(viewId);
        if (target != null) {
            target.setContentDescription(mContext.getString(contDescResId));
            text = mContext.getString(R.string.time_picker_increment_set_pm_button);
            mAmPmSpinner.findViewById(R.id.increment).setContentDescription(text);
            text = mContext.getString(R.string.time_picker_decrement_set_am_button);
            mAmPmSpinner.findViewById(R.id.decrement).setContentDescription(text);
        }
    }

Loading