jetc.dev Newsletter Issue #136
Beyond that, we look at the latest Compose updates, including an intriguing
new TV-specific pair of libraries. We examine performance (again), replacing
the “single live event” pattern, and getting a composified ExoPlayer to react
to the activity lifecycle. And we see an implementation of
ssp units for
Compose, to size things scaled based on screen size, font scale, and screen density.
(personally, I am holding out for SSPaaS — scalable SPs as a service — so we can scale our sizes… at scale)
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
This was an interesting week for releases.
First, we got Compose Compiler 1.3.2, with official support for Kotlin 1.7.20.
We also got a
1.3.0-rc01 release for the rest of the core Compose artifacts.
Besides your usual round of bug fixes, we also got an experimental API for
automatic hyphenation in text composables.
Wear Compose got a bump to
1.1.0-alpha07, with a bunch of new things, including:
Better font customization for
RadioButton()options for use with
To me, though, the most interesting development is one without Compose in the name.
We got a
1.0.0-alpha01 release of
androidx.tv:tv-material. Google does not appear to have announced anything
about them. However, from the release notes,
it is clear that these libraries form the basis of a TV-centric set of composables,
including carousels, TV-specific lazy containers, and more. I hope that we will
hear more about Google’s plans in this area in the coming months!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
If we are not over-composing, we are under-composing. Sometimes, your state might
not be represented by in-memory information, such as a
Uri pointing to an image
where the image content is new but the
Uri stays the same. You will need to
leverage some other state that changes in tandem to trigger recomposition, as we
see in this week’s highlighted Stack Overflow question.
Articles — such as the ones referenced in newsletters like this — sometimes
make broad-brush statements like “Use [flows] only if absolutely necessary”. Those
statements are not always accurate for all situations. Learn why
Flow is not
intrinsically bad, and the “tools not rules” philosophy, in this week’s highlighted
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Google’s Chris Arriola continues an introductory tour of Compose and Compose UI, this time looking at Android Studio features of use to composable developers, from Live Templates and Live Edit through various preview options. This material is also covered in an associated video.
Denis Rudenko spent a lot of time exploring performance tuning your composables and wrote a massive post explaining the findings. The “TL;DR/Summary” section is practically a post in itself. Denis explores stability/immutability, the use of lambdas, cross-module stability impacts, and more!
Elye is back with a pair of posts regarding
remember(). In the post linked to above,
Elye reviews the basics of recomposition and the impact of
some common scenarios for how composables get constructed. In
a follow-on Medium post
Elye examines some far less common scenarios, such as holding a composable
lambda in a local variable, and sees how
remember() and recomposition play out
One-time events have bedeviled Android developers for years. With Compose being
strongly state-driven, we have been advised to merge our events into our view states.
In this post, Yanneck Reiß reviews a library for trying to accomplish that,
by means of a
ExoPlayer is fairly critical in modern Android media app development, so there will
be continued work on figuring out how best to have ExoPlayer work with Compose UI.
Tobias Wissmueller continues an exploration of this subject, this time looking
at how a composable wrapper around ExoPlayer’s
StyledPlayerView can leverage
LocalLifecycleOwner to forward play/pause events to the player as the app is
moved to and from the background.
Thomas Künneth returns, this time looking at how to blend JavaBeans and
with Compose states. This is with an eye toward Compose for Desktop, where you might
be migrating legacy Swing-based UIs to using Compose and needing to work with
JavaBeans as part of that migration.
Other Interesting Links
- Medium: Chip Group in Jetpack Compose
- Medium: Custom Compose Layout with limited scope and modifiers inside
- Slides: Molecule: Using Compose for presentation logic
- Medium: Building A Jetpack Compose Window With AbstractComposeView
- Medium: The missing pieces of text alignment in Compose Text
- Medium: Jetpack Compose Activity for result handling mechanism for viewModel
- Medium: Auto-Spaced Text in Jetpack Compose
- Normal Variable vs remember vs remember mutabableStateOf Comparisons
- Medium: Jetpack compose: Cool Button Click Effects
- Navigation Compose
- Medium: Jetpack Compose Clean Navigation
- Medium: Type-safe arguments in JetPack Navigation Compose
- Medium: Jetpack Compose for Wear OS - Building Weather App
- Jetpack Compose Side Effects – With Examples
- Medium: Advanced work with the Snackbar in the Jetpack Compose
- Medium: Jetpack Compose Animations
- Medium: Easy animation on splash screen In android using jetpack compose
100% pure code!
Intuit published a library that lets you measure
sizes in “ssp” units, which take into account screen size, density, and font scaling.
Kaaveh Mohamedi created an equivalent for Compose UI, with
extension properties to let you specify sizes that take into account screen size
as well as screen density and (optionally) font scaling.
- 2024-02-20: Compose Multiplatform RCs! State! Nested scrolling! @firstname.lastname@example.org on Amper! Compose Cupertino! Compose... Hammer? And... we can memoize lambdas?!?
- 2024-02-13: Compiler 1.5.9! BOM 2024.02.00! New Glance libraries! @email@example.com on Circuit and Compose Multiplatform! Material3! Markdown! MVI! And... testing robots?!?
- 2024-02-06: A Compose Multiplatform survey and a patch! @firstname.lastname@example.org on font scaling! Modal bottom sheet close confirmation! Compose Multiplatform resources! Draggable items in lazy lists! And... @email@example.com talks to some Italians?!?