Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,11 @@ private void recreateFlingAnimation(int scrollY) {
float direction = Math.signum(mScroller.getFinalY() - mScroller.getStartY());
float flingVelocityY = mScroller.getCurrVelocity() * direction;

mScroller.fling(getScrollX(), scrollY, 0, (int) flingVelocityY, 0, 0, 0, Integer.MAX_VALUE);
// Proposed fix to handle overscroll
int maxScrollY = computeVerticalScrollRange() - getHeight(); // Calculate the actual scrollable range
maxScrollY = Math.max(0, maxScrollY); // Calculate the max bound to prevent negative bounds

mScroller.fling(getScrollX(), scrollY, 0, (int) flingVelocityY, 0, 0, 0, maxScrollY);
} else {
scrollTo(getScrollX(), scrollY + (mScroller.getCurrX() - scrollerYBeforeTick));
}
Expand Down