jetc.dev Newsletter Issue #42
This was a bit of a quiet week, owing to the Thanksgiving holiday in the US. But, Jetpack Compose is a global phenomenon! So, this week, we look at Navigation for Compose, including nested nav graphs and passing arguments. We also peek at Paging for Compose, applying it to various Web service APIs. We also see an IDE plugin for Compose colors, and we ponder what else in the Jetpack might get Compose-ified.
Note: due to a publishing problem, issue #41 was published to the Web several days late — sorry about that!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Scoping states for individual composables is easy. Scoping states for the entire app is easy. But, how do we scope states for intermediate structures, such as a group of screens? One answer comes from Navigation for Compose and viewmodels scoped to a navigation graph, as we see in this week’s highlighted Stack Overflow question.
Developers all too often ask how big the screen is. There is a Compose UI-specific solution for that, but it usually is the wrong question, as we explore in this week’s highlighted Kotlinlang Slack thread!
Posts, videos, and other new information related to Jetpack Compose!
Elye returns with a post that illustrates what “recomposition” means in Compose and how it impacts which of your composables gets run at various times. Come for the post; stay for the GIFs showing the impacts of different composable structures on what gets recomposed!
Ziv Kesten continues his examination of Navigation for Compose with two new posts. This one examines the “stringly-typed” approach that Navigation for Compose uses for arguments by default. Another post looks at the options for passing non-string types as arguments.
Vivek Singh has been experimenting with Paging for Compose, in his case use the TMDB API for displaying a scrolling list of movies. This post, and the accompanying GitHub repo, show his results!
Thomas Kuenneth has been experimenting with Compose for Desktop and is chronicling his exploits! His initial post sets up a basic Compose for Desktop UI, while his second post explores integrating with the desktop for drag-and-drop, particularly for accepting files and directories dropped from a desktop file explorer.
Adam Bennett has been delivering some presentations on the role of design systems and how one approaches them in Jetpack Compose. While video is not available (unfortunately!), Adam has published his slides.
100% pure code!
In Compose UI, our colors often are simple constants in Kotlin code, and right now
our IDEs lack gutter support to show what those colors look like, as we get with
Android color resources. Kaustubh Patange created an IDEA/Android Studio plugin
that offers such gutter previews for
Laurent Bernabé posted a pair of gists showing experiments with drag-and-drop within Compose. The original gist was for a fairly simple drag-and-drop scenario, while this one offers a return animation as well.
…And One More Thing
We have been seeing a trickle of Jetpack libraries getting Compose-ready editions, such as Navigation and Paging. And some libraries have been Compose-friendly for a while, such as Lifecycle. What else needs similar treatment?
I see four major buckets of candidate libraries for Compose integration:
Libraries tied to specialized device types: Car, Leanback (for TV), Wear
Libraries that wrap framework UI: Biometric, CameraX, Media2, WebKit
Libraries that are Compose-adjacent: Emoji, Palette, Preference, Print
Libraries that already support
LiveDatabut might be adapted to also support
State, such as DataStore, Room, and WorkManager
Eventually, many of the libraries from the first three bullets seem likely
to get Compose-friendly editions. Palette might get support for creating a
Preference might offer composables for matching the existing preference UI, and so
Not everything in the Jetpack will get the Compose treatment. Data binding, for example, is almost the anti-Compose at this point. Others, like ViewPager2, will get Compose equivalents but they may not necessarily be “branded” based on the original Jetpack library names. And others, like TextClassifier, may not have enough Compose ties to make a Compose-centric edition worthwhile.
In some cases, these libraries might be Compose-ified while Compose is still in pre-release form. Others might wind up waiting until Compose ships a stable release.
One way or another, the Jetpack is likely to have a Compose “vibe” to it in the coming years, if Compose keeps on its current trajectory.
- 2022-09-13: Compose updates! Tracking down and fixing recompositions! Maestro! Redwood! Molecule! And Twitter's rules for composables!
- 2022-09-06: Snapshots! A Glance support library! Measuring and drawing! Swipe-to-dismiss! Speed dials! And... a redwood sighting?!?
- 2022-08-30: Android 13 per-app language support! Performance optimizations! Expandable lists! MVI! Zooming! Steppers! And... another Compose beta? Already?!?