Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow scroll cause that not selection on item, remain between two item #11

Open
HosseinDevPro opened this issue Jun 13, 2020 · 0 comments

Comments

@HosseinDevPro
Copy link

When we scroll very slowly, it causes an error and didn't select any item and scroll position remain between two item and any item selection.
I debug this problem and find a solution, We need to refactor the ACTION_UP part in class WheelPicker as below:

MotionEvent.ACTION_UP -> { logd("### onTouchEventVertical: action > ACTION_UP") if (mIsDragging) { logd("onTouchEventVertical: is dragging > true") mIsDragging = false parent?.requestDisallowInterceptTouchEvent(false) mVelocityTracker?.computeCurrentVelocity(1000, mMaximumVelocity.toFloat()) val velocity = mVelocityTracker?.yVelocity?.toInt() if (Math.abs(velocity!!) > mMinimumVelocity) { logd("Velocity is bigger than minimum(" + mMinimumVelocity + "): " + velocity) mPreviousScrollerY = 0 mOverScroller?.fling( scrollX, scrollY, 0, velocity, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, (getItemHeight() * 0.7).toInt() ) invalidateOnAnimation() onScrollStateChange(OnScrollListener.SCROLL_STATE_FLING) } else { logd("Ooops.. >>> Velocity is smaller than minimum(" + mMinimumVelocity + "): " + velocity) val y = event.y.toInt() handlerClickVertical(y) } recyclerVelocityTracker() } else { logd("onTouchEventVertical: is dragging > false") //click event val y = event.y.toInt() handlerClickVertical(y) } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant