$30 off During Our Annual Pro Sale. View Details »

Strategies for Migrating to Jetpack Compose

Mohit S
April 19, 2022

Strategies for Migrating to Jetpack Compose

Mohit S

April 19, 2022
Tweet

More Decks by Mohit S

Other Decks in Programming

Transcript

  1. Strategies for Migrating to Jetpack Compose • Challenges • How

    to think about migration • Strategies & Tools
  2. Legacy Code Base View Holders Too much logic View Holder

    View Holder View Holder … Refactor to Compose
  3. Challenges • How do you reuse dimen and string resources?

    • Interop Theming • View lifecycle
  4. airbnb/Showkase Code ! Issues Pull Requests Showkase Compatible with Compose

    1.0.4 Showcase 1.0.0-beta12 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements.
  5. Showkase 9:41 App com.app General Logs Other Keyline overlay Slow

    down animations Network Activity Logs Lifecycle logs Show UX
  6. Showkase 9:41 App com.app General Logs Other Keyline overlay Slow

    down animations Network Activity Logs Lifecycle logs Show UX 9:41 Design Components Components Colors Typography
  7. Interop @Composable fun PostView() { AndroidView(factory = { context ->

    CustomView(context).apply { layoutParams = LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT ) } })
  8. cashapp/paparazzi Code ! Issues Pull Requests Paparazzi An Android library

    to render your application screens without a physical device or emulator.
  9. adrielcafe/lyricist Code ! Issues Pull Requests Lyricist The missing I18N

    and L10N multiplatform library for Jetpack Compose!
  10. Languages Support <resources> <string name=“greeting”>Hello world </ string> <string-array name="array">

    <item>Avocado </ item> </ string-array> <plurals name="plurals"> <item quantity="zero">%d zero </ item> </ plurals> </ resources>
  11. Languages Support <resources> <string name=“greeting”>Olá mundo </ string> <string-array name="array">

    <item>Abacate </ item> </ string-array> <plurals name="plurals"> <item quantity="zero">%d zero </ item> </ plurals> </ resources>
  12. Languages Support data class Strings( val greeting: String, val array:

    List<String>, val plurals: (quantity: Int) -> String ) object Locales { val En = "en" val Pt = "pt" }
  13. Languages Support @Preview @Composable fun PostViewPreview() { val xmlStrings =

    rememberXmlStrings() ProvideXmlStrings(xmlStrings) { Text(text = xmlStrings.greeting) } }
  14. Languages Support @Preview @Composable fun PostViewPreview() { val xmlStrings =

    rememberXmlStrings() ProvideXmlStrings(xmlStrings) { Text(text = xmlStrings.greeting) } }
  15. Languages Support @Preview @Composable fun PostViewPreview() { val xmlStrings =

    rememberXmlStrings() ProvideXmlStrings(xmlStrings) { Text(text = xmlStrings.greeting) } }
  16. Kotlin Upgrades This version (1.1.1) of the Compose Compiler requires

    Kotlin version 1.6.10 but you appear to be using Kotlin version 1.6.20 which is not known to be compatible.
  17. Strategies for Migrating to Jetpack Compose • Challenges • How

    to think about migration • Strategies & Tools