jetc.dev Newsletter Issue #131
This week, we look at bottom sheets and the “first composition” fallacy. We look at Glance support, sneak a peek at snapshots, and explore the measurement and drawing phases of compositions. We examine a pair of “speed dial” FAB implementations, plus we revisit some redwood.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
To close a
ModalBottomSheetLayout(), we need to call
hide() on its associated
state object. That is a
suspend fun, so we need to remember a
to pull that off. See how we can apply this to a close button in the sheet itself
in this week’s highlighted Stack Overflow question.
Posts, videos, and other new information related to Jetpack Compose!
Google’s Marcel Pintó takes a look at Google’s new
AppWidgetHost() composable to render your Glance-based
within your app, a
GlancePreviewActivity to let you
@Preview your Glance-based
app widgets, and more!
Amanda Hinchman-Dominguez and Google’s Jossi Wolf delivered a presentation on low-level Compose concepts, including snapshots, how the Compose Compiler works, what the results of the Compiler’s code-generation looks like, and more!
Google’s Zach Klippenstein also delivered a presentation about Compose snapshots, designed
to follow the preceding talk by Amanda and Jossi. As Zach puts it, “snapshots are Git
for your variables”, helping multiple threads work with consistent representations of
data without locking read access while writes are ongoing. Zach ties snapshots
into our Compose
MutableState objects and how they interact, as well as how you
can use listeners to find out about
Jorge Castillo returns, looking into the measuring and drawing phases of Compose UI.
Jorge discusses the roles of
LayoutNodeWrapper, what purpose
graphicsLayer() modifier serves, where “draw modifiers” come into play, and more!
Other Interesting Posts
- Dual-screen example adds Jetpack Compose to the experience
- Medium: Compose Pager
- Simple Google Map App - Jetpack Compose
- Custom Progress Bar with Jetpack Compose Canvas API: Tutorial
- Learning Kotlin Multiplatfom Mobile: Entry 3.5
- How to Master In Jetpack Compose? Here Are 10 Ways
- Medium: An iOS Engineer learns about Android’s Jetpack Compose and loves it
- Medium: Modern Android for iOS folks: Swift-Kotlin & SwiftUI-Compose
- Jetpack Compose: Basic components
100% pure code!
A few months ago, I wrote about a forthcoming library from CashApp called “Redwood”. That library is now publicly available, though it is “not ready for use by anyone”. The gist is that Redwood lets you create UIs through composables, but it is not opinionated as to how those UIs get rendered. That aspect is up to the project and is considered to be part of your overall design system. Redwood simply helps you update your design system UI elements — “composable functions render application state into the design system”.
Roberto Leinardi created a version of the “speed dial” style of FAB, both using
View system and as a composable.
SpeedDial() represents the FAB
FabWithLabel() composables represent the secondary buttons.
Alexander Karkossa also implemented a Material3 version of the “speed dial”
style of FAB, with
BottomAppBarSpeedDialFloatinActionButton() for the main FAB
FloatingActionButtonItem() composables for the individual secondary buttons.
Other Interesting Links
…And One More Thing
Five weeks ago, I wrote in this space about how Compose 1.2.0 coming out a year after 1.0.0 was a nice update pace.
Last week, Google released the first beta for Compose 1.3.0, less than three months after the corresponding beta release for Compose 1.2.0.
The closer you are to being a platform, the more important predictability becomes in release cycles. Updating to a new version of a platform tends to be more involved and take more effort than is updating to a new version of other libraries. Third parties that depend on the platform also need to update, adding to the overall complexity.
That’s why nobody bats an eye about release cycles for OkHttp, despite that library being all but essential to modern Android app development. Yet, Google’s release of Android 12L broke established release cycle patterns and caused a lot more concern. Android is a platform, OkHttp is not. Compose, especially Compose UI, is far closer to being a platform than is OkHttp.
I am not saying that the 1.0.0 -> 1.2.0 timeframe was right, or that the 1.2.0 -> 1.3.0 timeframe is wrong. I am saying that the apparent lack of release cycle predictability may add friction to Compose UI usage.
- 2023-11-21: Compose/Material3/Wear Compose updates! remember()! Adaptive layouts! Compose Multiplatform in 2024! @email@example.com on BasicTextField2()! Compose Multiplatform charts! And... is TV Compose in trouble?!?
- 2023-11-14: Compose Compiler! BasicTextField2()! @firstname.lastname@example.org and animations! Optimization! @email@example.com, 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 @firstname.lastname@example.org is in a bit of a haze?!?