Use custom logic for fragment back stack #3958
Merged
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.
This is a custom implementation of the back stack for our destinations. Previously, we used the back stack from the fragment manager but this didn't really work for us.
The problem was that we had to work around some shortcomings in the fragment manager due to how our destinations work. Specifically the "replace" action, mostly used when going from video player -> next up -> video player.
The way we made the replace action work was to pop the last item from the back stack, and then add a new item. This would result in the fragment before the video player (often the details page) to be resumed to then be replaced with the video player immediately after, because popping cannot be done in a transaction.
By replacing the back stack with our own implementation we have more control over this behavior and we can directly replace the fragment instead. Most of this logic is implemented in a custom view.
Changes
Issues
Fixes #3950
Fixes #3926
Fixes #2800
Fixes #3931