jetc.dev Newsletter Issue #79
1.1.0-alpha02 is out with a few changes!
We also look at modifiers and what happens when one depends on another. We take a deeper look at Compose performance, validate some input, and auto-size some text. And, I am worried about Compose-curious developers being able to get the support that they need.
Reviewing the release notes for the latest Jetpack Compose update!
Among other improvements,
1.1.0-alpha02 brings us:
The ability for
PointerEventto capture the state of mouse buttons and keyboard modifiers (e.g., Shift)
DpSizeclass, used with a new
DpRect()constructor and new variants of the
New scale-based enter and exit transition support
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Copying and pasting Compose code from before the 1.0.0 stable release is especially risky,
as the API changed quite a bit over the preceding 18 months. One developer learned
that lesson the hard way, when dealing with the old
preferredHeight() modifiers, in this week’s highlighted Stack Overflow
Modifiers are applied in a sequence. This poses an issue if one modifier
depends on another modifier having already been applied — if those modifiers
are used out of sequence, you might run into problems.
exhibit this dependent behavior, as we see in this week’s highlighted
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Will Shelor wanted to know whether using Compose UI was faster or slower at runtime
than was equivalent
View-based code. As we saw in last week’s issue,
Compose’s performance is dependent both on using R8 and on having the app’s code
be compiled ahead of time (AOT). Will’s analysis shows how you can perform those
sorts of measurements for your own Compose UI scenarios.
Ivan Morgillo and Sebastiano Poggi have been livestreaming some Compose UI experiments under the “Code with the Italians” moniker. In this episode, they are joined by Google’s Leland Richardson. Among other things, Leland takes a deep dive into measuring performance, in particular examining the results reported by Will Shelor in the blog post from the previous entry and emphasizing what one needs to get a good picture of how your composables are performing.
Denis Rudenko returns with an overview of how to apply validation logic to what
the user enters into a
TextField(), how to display those errors to the user,
and how to ensure that the error information and the user-entered text survives
configuration changes and short-term background process termination.
Peng Jiang wanted a UX akin to iOS’ Live Text: from an input field, you can request to grab an image off the camera, use OCR to identify text from that image, and paste that into the field. To accomplish this, Peng used CameraX and a Huawei OCR library, along with Compose UI.
Other Interesting Links
- Adding Animations to your Jetpack Compose Navigation
- Lottie Animation in Android Jetpack Compose
- Jetpack Compose: Implementing the Detail View (Part IV)
- Video: How to Make A Bottom Navigation With Badges in Jetpack Compose
- Video: Becoming a Jetpack Composer
- Medium: Simple Sharing Color Theming for XML and Jetpack Compose
- Medium: Part II: How to create an auto-update for Desktop application (GitHub Actions)
- Medium: Animating Image Size While Scrolling
- Video: LazyColumn - Forget about RecyclerView Adapter
- Jetpack Compose: A Turning Point for Native Android UI
- Testing in Jetpack Compose
- Video: Jetpack Compose State Management
- Observing Live Connectivity Status in Jetpack Compose Way!
100% pure code!
Aidan McWilliams brings us an example of how to use
Parcelable arguments when
implementing navigation using Navigation for Compose, by automatically putting
those arguments into the
Bundle associated with the
Other Interesting Links
…And One More Thing
Now that Compose has a stable release, there will be a steady influx of developers who wish to use it. The challenge that poses is: where will they get help?
Right now, the best source of help for developers is Kotlinlang Slack’s
channel. That was set up shortly after Google released the first developer preview
of Compose, and Google engineers and developer advocates have spent a lot of time
there. Many developers have received deep and excellent advice there.
However, there are problems with the solution.
Some of those problems are endemic to Slack. Slack is like Las Vegas: what happens
in Slack, stays in Slack. Slack’s search facility is nearly useless, and Slack’s
“walled garden” approach means that it is not indexed by public search engines.
This means that the value of any advice decays rapidly: mostly, it helps people who happen
to be following the
#compose channel at the time the advice is given. That is why
I have been “rescuing” a thread per week in the “One Off the Slack” series —
I am simply trying to ensure that some of the great advice gets into public
Beyond that, there is the risk that Google’s involvement may tail off. This would not be that surprising — getting two years of near-real-time official support was a minor miracle. With luck, the developer ecosystem can help fill in. However, this sort of transition from company-led support to community-led support is risky. This is exacerbated by Slack’s limitations — if community members tire of dealing with duplicate questions caused by lousy search options, it is possible that the channel will fade into obscurity.
If you know of Compose support sites, beyond the
#compose Slack channel
and Stack Overflow,
please let me know. I would love to be able to promote
other options, so developers have more choices for where they can get the answers that they need.
- 2023-01-24: Locales! Relay! Effects! Paging! Foldables! Permissions! Date pickers! Bi-directional scrolling! And what your MaterialTheme means... for your SwiftUI code?!?
- 2023-01-17: New Compose patches and alphas! Dealing with Navigation for Compose! Scaffolds! QR codes! Server-defined UI! And @firstname.lastname@example.org has joined the BOM squad! 😁 💥
- 2023-01-10: onNewIntent() and composables! ContactsContract and composables! Balloons! QR codes! Pencils! And a focus on focus!