8000 Simplify and improve `previousBackStackEntry` in `NavController` by ShreckYe · Pull Request #742 · androidx/androidx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Simplify and improve previousBackStackEntry in NavController #742

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

Open
wants to merge 1 commit into
base: androidx-main
Choose a base branch
from

Conversation

ShreckYe
Copy link
Contributor
@ShreckYe ShreckYe commented Jan 4, 2025

Proposed Changes

  • Simplify and improve previousBackStackEntry in NavController

    asReversed is used instead of reversed to reduce the cost of copying a list. The reversed list is converted to a Sequence earlier and drop(1) is used instead of the iterator to simplify the code.

    This change stems from the work done in Add previousBackStackEntryFlow in NavController and NavController.previousBackStackEntryAsState #740. This change should also conflict with that PR. I can rebase/merge from that PR here, or rebase/merge from this PR in that PR if either of them is merged into the main branch first.

Testing

Test: Run ./gradlew :navigation:navigation-runtime:connectedCheck in "playground-projects/navigation-playground"

`asReversed` is used instead of `reversed` to reduce the cost of copying a list. The reversed list is converted to a `Sequence` earlier and `drop(1)` is used instead of the iterator to simplify the code.
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.

1 participant
0