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

Commit 6c742f1e authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Catching some edge cases while flinging/scrolling in NumberPicker

1. If the scroll is exactly divisible by the scroll item height
   the selector wheell is one off from the current value/text input.

Change-Id: I12721e85a99f6a5b51f5ad6f13c3836cb156c9a4
parent 38f79d01
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -754,7 +754,7 @@ public class NumberPicker extends LinearLayout {
            return;
        }
        mCurrentScrollOffset += y;
        while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorElementHeight) {
        while (mCurrentScrollOffset - mInitialScrollOffset >= mSelectorElementHeight) {
            mCurrentScrollOffset -= mSelectorElementHeight;
            decrementSelectorIndices(selectorIndices);
            changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -762,7 +762,7 @@ public class NumberPicker extends LinearLayout {
                mCurrentScrollOffset = mInitialScrollOffset;
            }
        }
        while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorElementHeight) {
        while (mCurrentScrollOffset - mInitialScrollOffset <= -mSelectorElementHeight) {
            mCurrentScrollOffset += mSelectorElementHeight;
            incrementScrollSelectorIndices(selectorIndices);
            changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -1147,8 +1147,8 @@ public class NumberPicker extends LinearLayout {
            postAdjustScrollerCommand(0);
            tryNotifyScrollListener(OnScrollListener.SCROLL_STATE_IDLE);
        } else {
            showInputControls();
            updateInputTextView();
            showInputControls();
        }
    }

@@ -1537,8 +1537,8 @@ public class NumberPicker extends LinearLayout {
        public void run() {
            mPreviousScrollerY = 0;
            if (mInitialScrollOffset == mCurrentScrollOffset) {
                showInputControls();
                updateInputTextView();
                showInputControls();
                return;
            }
            // adjust to the closest value