fix(workspace): rework infinite scrolling without wrap state (#7413)

Infinite scrolling kept a wrap state (target page, saved scroll bounds,
a cached feed flag) that every path out of a swipe had to tear down.
Paths that missed it caused the bugs: a short or backward swipe on the
last page wrapped anyway, the first page flashed when a layout pass
reset the bounds mid-wrap, touching during a wrap jumped to the target,
two-panel layouts got stuck between pages, and the page indicator lost
its active dot.

The wrap now follows from the scroll position alone: on an end that
wraps, the scroll may run one screen further, and the screen from the
other end is translated into that gap. Workspace decides which ends
wrap; other paged views behave as in AOSP.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
x-JOCandClaude Opus 5.5 authored and GitHub committed 2026-10-21 19:41:57 +08:00
1 parent d9afe890a3
commit 6c2c2c22ef
2 files changed
+165 -290

No files matched your search

+10
View File
@@ -1514,6 +1514,16 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
}
}
@Override
protected boolean canWrapPastEnd(boolean maxEnd) {
if (!mPreferenceManger.getInfiniteScrolling().get()) {
return false;
}
// LC-Note: The side before the first page belongs to the feed while it is on.
return getPageAtEnd(maxEnd) != 0
|| !PreferenceCacheExtensionsKt.firstCached(mPreferenceManager2.getEnableFeed());
}
@Override
protected boolean shouldFlingForVelocity(int velocityX) {
// When the overlay is moving, the fling or settle transition is controlled by the overlay.