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

Use LazyListUpdateProcessor for Android views #1570

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

swankjesse
Copy link
Collaborator

@swankjesse swankjesse commented Oct 6, 2023

Closes: #1552

@@ -250,15 +250,13 @@ internal class LazyListContainerCell(

// Unbind the cell when its view is detached from the table.
if (superview != null && newSuperview == null) {
removeAllSubviews()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now performed by unbind() below.

} else if (holder.container.height == 0) {
// This occurs when the ViewHolder has been freshly created, so we set the container
// to a non-zero height so that it's visible.
holder.itemView.updateLayoutParams { height = lastItemHeight }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big regression here . . . I need to add a hook to create placeholders on-demand.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracking here: #1571

}

private class FakeWindowedLazyList : WindowedLazyList<WidgetValue>(NoOpListUpdateCallback) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we used the compose-side LazyList to drive this on the widget-side.

With FakeProcessor we’ve got a test facet for the widget side and I don’t think this integration test is necessary.

// This incorrectly updates the viewport, which then shifts the loaded items window.
// This then increases the value of itemsBefore,
// and the cycle continues until the backing dataset is exhausted.
adapter.notifyDataSetChanged()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@swankjesse swankjesse force-pushed the jwilson.1006.actually_recycler_view branch from 75d3d4f to f08c6e0 Compare October 6, 2023 18:31
@swankjesse swankjesse requested a review from veyndan October 6, 2023 18:31
@swankjesse
Copy link
Collaborator Author

lazylist.mp4

Copy link
Collaborator

@JakeWharton JakeWharton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say I fully understood everything, but LGTM

Base automatically changed from jwilson.1006.recycler_view to trunk October 10, 2023 17:04
@swankjesse swankjesse force-pushed the jwilson.1006.actually_recycler_view branch from f08c6e0 to 1cbcff1 Compare October 10, 2023 17:06
@swankjesse swankjesse enabled auto-merge (squash) October 10, 2023 17:06
@swankjesse swankjesse merged commit ba71d57 into trunk Oct 10, 2023
8 checks passed
@swankjesse swankjesse deleted the jwilson.1006.actually_recycler_view branch October 10, 2023 17:25
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

Successfully merging this pull request may close these issues.

Migrate ViewLazyList to use LazyListUpdateProcessor
3 participants