-
Notifications
You must be signed in to change notification settings - Fork 77
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
WIP RetainedStateHolder #1168
Draft
ZacSweers
wants to merge
12
commits into
main
Choose a base branch
from
z/stateInTabs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP RetainedStateHolder #1168
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e428463
Move contentComposed to the end
ZacSweers a8544ae
WIP persist tab state
ZacSweers 13622e9
Spotless
ZacSweers 920299b
Merge branch 'main' into z/stateInTabs
ZacSweers dca28da
Add RetainedStateHolder impls
ZacSweers 73d98bd
Add leak canary wrapper rule
ZacSweers 21b0e15
Add RetainedStateRestorationTester
ZacSweers 068c1a8
Spotless
ZacSweers 70a1512
Use in HomeScreen
ZacSweers b2d0e16
Switch back
ZacSweers 924ecab
Add to manifest
ZacSweers 848ca4e
Merge branch 'main' into z/stateInTabs
ZacSweers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: loading. I think the solution here is to do something like having a map of nav items to their presenter state that is instantiated and rememberRetained above this section.
And then have a "presenter facade" which switches state to the presenter state that is currently being shown.
This is effectively what I'm doing in my project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because we don't retain state for root back stack changes, only back stack additions (effectively).
This has been at the back of my mind for a while (and mildly annoys me every time I use Tivi).
So this change stores the tab index across app starts, but the state of that tab won't be retained if you switch between them.
There is a comment in the code somewhere from when I wrote the retain backstack stuff, let me find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find it now, but I think this might actually be as simple as making
buildCircuitContentProviders
a bit smarter, and manually retaining any dropped root records.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on this in #1173