am 48b428fb: Merge "NumberPicker getting stuck if scroll wheel not wrapable." into ics-mr1
* commit '48b428fb1369a787a15fa6d8ebf10f8b31937a8b': NumberPicker getting stuck if scroll wheel not wrapable.
This commit is contained in:
@@ -776,6 +776,7 @@ public class NumberPicker extends LinearLayout {
|
|||||||
mBeginEditOnUpEvent = false;
|
mBeginEditOnUpEvent = false;
|
||||||
mAdjustScrollerOnUpEvent = true;
|
mAdjustScrollerOnUpEvent = true;
|
||||||
if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
|
if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
|
||||||
|
mSelectorWheelPaint.setAlpha(SELECTOR_WHEEL_BRIGHT_ALPHA);
|
||||||
boolean scrollersFinished = mFlingScroller.isFinished()
|
boolean scrollersFinished = mFlingScroller.isFinished()
|
||||||
&& mAdjustScroller.isFinished();
|
&& mAdjustScroller.isFinished();
|
||||||
if (!scrollersFinished) {
|
if (!scrollersFinished) {
|
||||||
@@ -1597,23 +1598,11 @@ public class NumberPicker extends LinearLayout {
|
|||||||
*/
|
*/
|
||||||
private void fling(int velocityY) {
|
private void fling(int velocityY) {
|
||||||
mPreviousScrollerY = 0;
|
mPreviousScrollerY = 0;
|
||||||
Scroller flingScroller = mFlingScroller;
|
|
||||||
|
|
||||||
if (mWrapSelectorWheel) {
|
if (velocityY > 0) {
|
||||||
if (velocityY > 0) {
|
mFlingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
|
||||||
flingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
|
|
||||||
} else {
|
|
||||||
flingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (velocityY > 0) {
|
mFlingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);
|
||||||
int maxY = mTextSize * (mValue - mMinValue);
|
|
||||||
flingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, maxY);
|
|
||||||
} else {
|
|
||||||
int startY = mTextSize * (mMaxValue - mValue);
|
|
||||||
int maxY = startY;
|
|
||||||
flingScroller.fling(0, startY, 0, velocityY, 0, 0, 0, maxY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user