You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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) } }
The text was updated successfully, but these errors were encountered:
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) } }
The text was updated successfully, but these errors were encountered: