jetc.dev Newsletter Issue #116
Google I|O 2022 happened, and we have the pictures (well, OK, videos) to prove it!
Beyond that, we peek at what’s new in the
beta01 releases for Compose and Wear Compose.
We look at the underpinnings of the state system and how to leverage
for performance. We see libraries for credit card fields and app intros. And, we learn
what a “horologist” is, at least from the standpoint of Wear Compose.
Reviewing the release notes for the latest Jetpack Compose update!
1.2.0-beta01 was released in time for Google I|O 2022. Of note:
We got several changes to the line height APIs, mostly types being renamed, plus
LineHeightBehavior(to control what happens with the top and bottom lines of text)
LazyLayoutItemsProviderreceived several changes
SpanStylenow have access to a
Brushfor gradient fills
We got a new platform-independent test API, in the form of
ComposeUiTestinterface — implementations (
DesktopComposeUiTest) can run Compose tests without a
Wear Compose also went to a beta (
1.0.0-beta01). Of note there:
CurvedModifier.padding...()functions are now available to provide more space around a curved component
TitleCard()now have an
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
In short: no, it is not OK. However, this is a subtle issue and one that you might
easily miss… until you get an inscrutable error message and massive stack trace.
Learn more in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
This official blog post was released as part of Google I|O 2022 and mostly covers what is included in Compose 1.2. Note that this post covers items new since Compose 1.1, not just what is new in the Compose 1.2 beta.
Google’s Zach Klippenstein continues a deep dive into how snapshots work “under the hood”. This time, Zach explores the details behind “state objects” and how the snapshot system uses a version control system to keep state atomic within a snapshot but mutable between snapshots. As Zach puts it, “these details are not at all necessary to use Compose even for many advanced use cases, and you can have a whole successful career as a Compose developer without knowing any of it. It’s just really, really cool.”
James Shvarts continues a tour of Compose concepts, this time looking at the three phases of Compose UI rendering: composition, layout, and drawing. In particular, James looks at how we can skip one (or more) of those phases for a frame, to improve performance.
Mohit Sarveiya delivered a presentation for Android Worldwide reviewing many aspects of migrating large code bases to Compose UI. Mohit covers everything from testing and interop with legacy code to language support and issues with Kotlin version compatibility.
Other Interesting Links
- Medium: TLDR — Parallax Scrolling with Jetpack Compose
- Medium: Jetpack Compose Theming: Colors
- Medium: Animated grid in Jetpack Compose
- Medium: Glassmorphism in Jetpack Compose for scrolling item
- Medium: Detect Swipe Direction on Jetpack Compose to trigger BottomSheetScaffold
- Simple Jetpack Compose Navigation Example
- Medium: Collapsing Toolbar in Jetpack Compose (‘Column’ version)
- Image Slider with the indicator Using Jetpack compose
- Jetpack Compose for Late Adopters
100% pure code!
Just as Accompanist is Google’s extension library for Compose UI, Horologist is Google’s extension library for Compose for Wear (and other Wear OS development). It is possible that some of these things will be promoted into Compose for Wear in the future.
Google also released an app for Now In Android, the weekly blog / podcast / video covering official Android news. The app was written in Compose Material and is designed to serve as a first-class demonstration of Compose techniques, in addition to being directly useful for obtaining Android content.
Ranbir Singh created a Compose UI-based framework for creating those step-at-a-time app introduction wizards, where you supply composables for what goes on each page and the framework handles transitions.
Jamal Mulla is back, this time with a Material3 implementation of a preference UI, following up on his earlier Compose Material preference UI.
…And One More Thing
Google I|O 2022 is in the books, and remarkably few ground-breaking improvements came out of it for Compose developers. Admittedly, the Live Edit experience added to Android Studio Electric Eel was shocking to see.
(and, if you didn’t expect that awful pun, you don’t know me very well…)
Tooling improvements like that are very welcome. But if you were expecting Compose for Stoves, or a new “Material Us” design language with Compose support, you may have been disappointed. We got new betas, and some more Google libraries and samples, but that was about it. IMHO, going a bit slow this cycle is not a bad thing, in that it helps the broader Android ecosystem catch up. While many developers love a cycle of continuous change, many other developers deeply resent the “hamster wheel” that continuous change represents.
Here are YouTube links for the I|O 2022 sessions that specifically called out Compose in their descriptions, from my roster from two weeks ago.
- 2023-11-21: Compose/Material3/Wear Compose updates! remember()! Adaptive layouts! Compose Multiplatform in 2024! @firstname.lastname@example.org on BasicTextField2()! Compose Multiplatform charts! And... is TV Compose in trouble?!?
- 2023-11-14: Compose Compiler! BasicTextField2()! @email@example.com and animations! Optimization! @firstname.lastname@example.org, JetBrains, and Fleet! JetBrains and plotting! And... we collapse?!?
- 2023-11-07: Compose Multiplatform! Chips in fields! Diffing! Custom fonts in Glance app widgets! Heatmaps! PIN input! And @email@example.com is in a bit of a haze?!?