Repository navigation
Keep album thumbnail cells across message binds - #2278
Draft
mpretty-cyro wants to merge 1 commit into
Draft
mpretty-cyro wants to merge 1 commit into
mpretty-cyro wants to merge 1 commit into
Conversation
Every bind of a message started by clearing the album view, which removed its cells and reset what it reuses them for. So every image message inflated its cells again on each bind, and its thumbnails started new Glide loads even when the slide hadn't changed. The album is already hidden at the start of each bind and shown only for image messages, so the cells are now left in place. They're reused whenever the album needs the same layout, which albums of three or more share (the "and N more" text is now set on every bind), and a cell showing the same slide skips the load.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributor checklist
playflavour,qaFixes #1234syntaxDescription
Slow frames when scrolling past image messages.
VisibleMessageContentView.bindstarted every bind by callingalbumThumbnailView.clearViews(). That removed the album's cells and reset the sizeAlbumThumbnailViewreuses them for, so its reuse check never matched. Every image message inflated its cell layout again on every bind, and the newThumbnailViews started Glide loads even when the slide hadn't changed.The album is already hidden at the start of each bind and only shown again for image messages, so the cells are now left in place:
AlbumThumbnailViewreuses them whenever the album needs the same layout. Albums of three or more images all share the three-cell layout, and the "and N more" text is now set on every bind.ThumbnailViewthat's already showing the same slide skips the load. Its existing equality check coversuri,thumbnailUriandtransferState, so a changed or newly downloaded slide still reloads.The
clearViews()call on the attachment-download path is unchanged.Confidence: high that it removes the re-inflation. Medium on how much it helps real scrolling, which depends on how often neighbouring albums share a layout. Most image messages are single images.
Testing: a local build of 1.33.9 with this change and the record cache (#2277) on top, on a Note to Self with albums of 1, 2, 3 and 4 images mixed among texts. With a temporary counter (not in this PR), one scripted scroll did 29 image-message binds: 15 reused their cells and 14 inflated. Before this change every one of them inflates. The test data deliberately alternates album sizes; runs of single images reuse every time.
I checked by eye: