Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jetpack Compose Navigation

Jetpack Compose Navigation

Slides from Jetpack Compose Meetup by Android KZ - https://www.youtube.com/watch?v=nAJj3zyUOqc

Zhanibek Marshal

August 06, 2022
Tweet

More Decks by Zhanibek Marshal

Other Decks in Programming

Transcript

  1. Zhanibek Marshal, 6 August 2022 Navigating screens on Jetpack Compose

    Перемещаемся между экранами как надо
  2. 2008 Переходы по Activity Intent Fragment Manager Jetpack Navigation 2011

    Поддержка больших экранов с помощью Fragment Тоже переходы по Fragment Но теперь в Navigation Graph 2019
  3. 2008 Переходы по Activity Intent Fragment Manager Jetpack Navigation 2011

    Поддержка больших экранов с помощью Fragment Тоже переходы по Fragment Но теперь в Navigation Graph 2019
  4. 2008 Переходы по Activity Intent Fragment Manager Jetpack Navigation 2011

    Поддержка больших экранов с помощью Fragment Тоже переходы по Fragment Но теперь в Navigation Graph 2019
  5. 1 Activity + n * Fragment Современный подход Activity Fragment

    A Fragment B Fragment A Fragment B ViewModel A ViewModel B Activity Lifecycle Fragments Lifecycle ViewModel Lifecycle
  6. 1 Activity + n * Compose Screen Как было изначально

    Activity Fragment A Fragment B Fragment A Fragment B ViewModel A ViewModel B Activity Lifecycle Fragments Lifecycle ViewModel Lifecycle
  7. 1 Activity + n * Compose Screen А теперь вот

    так Activity Screen A Screen B Screen A Screen B Screen A ViewModel Screen B ViewModel Activity Lifecycle Fragments Lifecycle ViewModel Lifecycle
  8. 1 Activity + n * Compose Screen Должен быть NavHost

    Activity Screen A Screen B Screen A Screen B Screen A ViewModel Screen B ViewModel Activity Lifecycle Fragments Lifecycle ViewModel Lifecycle NavHost
  9. Navigation Options PopUpTo A B C A Stack B C

    navigate(“A”) { popUpTo(“A”) }
  10. Navigation Options PopUpTo & Inclusive A B C A Stack

    B C navigate(“A”) { popUpTo(“A”) { inclusive = true } }
  11. Navigation Options PopUpTo & Inclusive A B C A Stack

    navigate(“A”) { popUpTo(“A”) { inclusive = true } }
  12. Полезные ссылки • Modular Navigation with Jetpack Compose: Joe Birch

    
 https://medium.com/google-developer-experts/modular-navigation-with- jetpack-compose-fda9f6b2bef7 • Jetpack Compose: Navigation with Alex Zhukovich
 https://www.youtube.com/watch?v=dYTfYGwINlo • Jetpack Compose Navigation: code lab from Google
 https://developer.android.com/codelabs/jetpack-compose-navigation