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

Migrate to type-safe Navigation and enable predictive back animations #22

Merged
merged 5 commits into from
May 18, 2024
Merged

Migrate to type-safe Navigation and enable predictive back animations #22

merged 5 commits into from
May 18, 2024

Conversation

cbeyls
Copy link
Contributor

@cbeyls cbeyls commented May 16, 2024

🎯 Goal

  • Simplify navigation code by using type-safe routes introduced in Navigation 2.8.0-alpha08.
  • Upgrade navigation and compose libraries to support predictive back animation for the shared element transition.

🛠 Implementation details

  • Upgrade Compose, Navigation, Kotlin and other libraries.
  • Make AppComposeNavigator class type-safe for routes.
  • Make PokedexScreen the base route type for the application.
  • Remove code for formatting route strings.
  • Change NavigationCommand to a sealed interface.
  • Turn PokemonType into an object and override the proper method for serialization.
  • Use BundleCompat.getParcelable() to fetch a Parcelable from a Bundle instead of the custom implementation.
  • Turn Dagger NavigationModule into an interface.
  • Use proper aliases for Gradle plugins when applicable.
  • Remove unused Compose UI dependencies from the navigation module.
  • Enable predictive back animations in Manifest.

@cbeyls cbeyls requested a review from skydoves as a code owner May 16, 2024 16:46
Copy link
Owner

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Great work, nicely done, @cbeyls! 🙌

@skydoves skydoves merged commit 10a0464 into skydoves:main May 18, 2024
2 checks passed
@cbeyls
Copy link
Contributor Author

cbeyls commented May 18, 2024

FYI the return transition is still glitching since day 1, and you can see the glitch in the gif animation in the README.
There issues are:

  1. the image briefly disappears when the return transition starts.
  2. the image immediately jumps to its smaller size.
  3. the text immediately jumps to its smaller size.

Number 1 is probably caused by a bug in Landscapist since I tried switching to the official Glide Compose API and it eliminates the issue.
Number 3 can be fixed by using Modifier.sharedBounds() which is recommended for text anyway.
I didn't find a proper fix for number 2, I need to double-check if it works for a minimal sample project.

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.

2 participants