File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -26676,6 +26676,7 @@ package android.widget {
2667626676 method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener);
2667726677 method public void setValue(int);
2667826678 method public void setWrapSelectorWheel(boolean);
26679+ field public static final int SELECTOR_WHEEL_ITEM_COUNT = 5; // 0x5
2667926680 }
2668026681
2668126682 public static abstract interface NumberPicker.Formatter {
Original file line number Diff line number Diff line change 7070@ Widget
7171public class NumberPicker extends LinearLayout {
7272
73+ /**
74+ * The number of items show in the selector wheel.
75+ */
76+ public static final int SELECTOR_WHEEL_ITEM_COUNT = 5 ;
77+
7378 /**
7479 * The default update interval during long press.
7580 */
@@ -1137,14 +1142,17 @@ public boolean getWrapSelectorWheel() {
11371142 * items shown on the selector wheel) the selector wheel wrapping is
11381143 * enabled.
11391144 * </p>
1140- *
1145+ * <p>
1146+ * <strong>Note:</strong> If the number of items, i.e. the range
1147+ * ({@link #getMaxValue()} - {@link #getMinValue()}) is less than
1148+ * {@link #SELECTOR_WHEEL_ITEM_COUNT}, the selector wheel will not
1149+ * wrap. Hence, in such a case calling this method is a NOP.
1150+ * </p>
11411151 * @param wrapSelectorWheel Whether to wrap.
11421152 */
11431153 public void setWrapSelectorWheel (boolean wrapSelectorWheel ) {
1144- if (wrapSelectorWheel && (mMaxValue - mMinValue ) < mSelectorIndices .length ) {
1145- throw new IllegalStateException ("Range less than selector items count." );
1146- }
1147- if (wrapSelectorWheel != mWrapSelectorWheel ) {
1154+ final boolean wrappingAllowed = (mMaxValue - mMinValue ) >= mSelectorIndices .length ;
1155+ if ((!wrapSelectorWheel || wrappingAllowed ) && wrapSelectorWheel != mWrapSelectorWheel ) {
11481156 mWrapSelectorWheel = wrapSelectorWheel ;
11491157 updateIncrementAndDecrementButtonsVisibilityState ();
11501158 }
You can’t perform that action at this time.
0 commit comments