Skip to content

Commit 48b428f

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "NumberPicker getting stuck if scroll wheel not wrapable." into ics-mr1
2 parents 583fdf0 + 234484a commit 48b428f

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

core/java/android/widget/NumberPicker.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
776776
mBeginEditOnUpEvent = false;
777777
mAdjustScrollerOnUpEvent = true;
778778
if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
779+
mSelectorWheelPaint.setAlpha(SELECTOR_WHEEL_BRIGHT_ALPHA);
779780
boolean scrollersFinished = mFlingScroller.isFinished()
780781
&& mAdjustScroller.isFinished();
781782
if (!scrollersFinished) {
@@ -1597,23 +1598,11 @@ private void onScrollStateChange(int scrollState) {
15971598
*/
15981599
private void fling(int velocityY) {
15991600
mPreviousScrollerY = 0;
1600-
Scroller flingScroller = mFlingScroller;
16011601

1602-
if (mWrapSelectorWheel) {
1603-
if (velocityY > 0) {
1604-
flingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
1605-
} else {
1606-
flingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
1607-
}
1602+
if (velocityY > 0) {
1603+
mFlingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
16081604
} else {
1609-
if (velocityY > 0) {
1610-
int maxY = mTextSize * (mValue - mMinValue);
1611-
flingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, maxY);
1612-
} else {
1613-
int startY = mTextSize * (mMaxValue - mValue);
1614-
int maxY = startY;
1615-
flingScroller.fling(0, startY, 0, velocityY, 0, 0, 0, maxY);
1616-
}
1605+
mFlingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
16171606
}
16181607

16191608
invalidate();

0 commit comments

Comments
 (0)