jetc.dev Newsletter Issue #81
1.1.0-alpha03 is out! And, in this week’s “…And One More Thing”, I make some
projections of how long before a 1.1.0 stable release comes out.
Also, we learn from Googlers about the perils of
Parcelable and the science
SideEffect. We debug excessive recomposition, look at sharing a KMP library
of composables with an Android app, and rendering grids and timelines.
Reviewing the release notes for the latest Jetpack Compose update!
1.1.0-alpha03 makes some interesting changes. The big one is support for Kotlin 1.5.30.
The compiler plugin now supports older versions of the runtime, whereas previously the plugin and runtime libraries had to match versions
OverScrollConfigurationoption gives us glow effects for overscrolls
ViewConfigurationnow offers a minimum touch target size
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
A long-standing fight with Navigation for Compose has been passing complex
arguments in the form of
Parcelable classes. Google’s Ian Lake demonstrates
how to avoid that for passing around model objects in this week’s highlighted
Stack Overflow question.
One of the more confusing aspects of Compose is the need for the
composables. See one take on where and how to employ a
SideEffect in this week’s
#compose Slack thread!
Posts, videos, and other new information related to Jetpack Compose!
Damian Petla wrote an extensive post examining the process in debugging recomposition, to determine why a particular composable was recomposing when it seemed to be unnecessary. See how a lambda expression turned out to be the source of the difficulty!
Halil Ozercan is back, this time taking a look at how to share composables between Android and desktop projects. In particular, Halil focuses on having a KMP library of composables that you consume in an Android project, looking at three different ways to get the dependencies to resolve correctly.
Tom Seifert was excited to apply Navigation for Compose to a project, but ran into
various problems and points of confusion. In this post, Tom reviews some of those problems,
such as determining the lifecycle of Navigation-created viewmodels, how to deal
@Preview, and more!
Suraj Sao walks through an implementation of drag-and-drop for row reordering in
LazyColum(), using long-click gestures to trigger the drag-and-drop behavior,
moving the row being dragged, and handling overscroll.
Alex Zhukovich returns, looking this time at the experimental
composable, as well as “classic” ways of creating grids using a mix of
LazyColumn(). UI patterns demonstrated here include galleries and HTML-style
Ivan Morgillo and Sebastiano Poggi of “Code with the Italians” fame posted a two-hour screencast, featuring Xoogler Chris Banes, the original author of the Accompanist library. This episode spends a lot of time on Accompanist and its use, including recent additions like Accompanist Navigation Animation.
Filip Babić delivered a presentation at MobileWeek 2021 on some of the design and implementation decisions that Stream needed to make when creating a Compose UI-based library for implementing chat UIs. This is particularly challenging, since their library needs to allow some measure of customizing that UI, and we do not have many patterns of implementing such libraries for widespread use.
Other Interesting Links
- Video: Comparing Jetpack Compose and SwiftUI: Fun with Declarative UIs
- Video: Custom View with Jetpack Compose
- Medium: Jetpack Compose with more complex Previews/ Live previews and ViewModels
- Medium: Building a Modern Call Recorder with Kotlin + Android Jetpack: Chapter 1
- Create a code editor with Compose for Desktop
- Video: Canvas Basics in Jetpack Compose
- Medium: Checkmate on Compose — Part I
- Medium: Circular Reveal in Jetpack Compose
- Medium: Lists using LazyColumn in Jetpack Compose
- Rows and Columns in Jetpack Compose Android
- List animations in Compose: Add an item
- Video: Jetpack Compose Animations basics
100% pure code!
Some apps, such as bus or train schedules, need to show a timeline: a series of events, some with specific markers.
Ji Sungbin created a
TimeLine() composable for rendering such a bit of UI,
with customizable colors and marker icons.
…And One More Thing
A couple of weeks ago, a reader asked in Kotlinlang Slack:
How long does a new Compose release normally take? I’m wondering about 1.1.0. It fixes the
TextFieldfocus adding to the backstack problem.
Since we have only had one stable release of Compose so far, it is difficult to guess
how frequently we might get minor releases. Presumably they will be faster than
the year it took to get from
1.0.0-alpha01 to a stable
1.0.0. But… how much faster
might it be?
Some library groups are notoriously slow. For example, it took nearly 1.5 years for
to get to their first stable release, and it has been over a year since
the first 1.1.0 alpha. I sincerely hope that Compose ships stable releases more frequently.
Here is the rough time from the first alpha of a minor release to the stable release for some of the major Jetpack library groups:
- Activity: 8 months
- AppCompat: 8 months
- Core: 7 months
- Lifecycle: 10 months
- Navigation: 5 months
- Room: 7 months
- WorkManager: 4 months
My guess is that Compose will be on the slower side — more like Lifecycle and less like WorkManager. That is just due to the sheer size of Compose and the number of “moving parts” that are involved. So, if I had to guess, I would expect 6-10 months from first alpha to the stable release. That would put the 1.1.0 stable release in early 2022.
It would not stun me if they move a bit quicker than that. Only time will tell. But if you are dependent upon some bug fixes, ask on relevant tickets if they are planning on backporting a 1.1.0 fix into a 1.0.x patch release. If the bug is egregious enough, hopefully they will consider it.
- 2021-09-07: 1.1.0-alpha03! Parcelable in Navigation... or not! SideEffect! Recomposition! Sharing KMP code! Grids! Timeline UIs, and timelines of stable releases!
- 2021-08-31: rememberUpdateState()! Paging! AndroidView()! @TouchlabHQ on animations and a composable KaMP Kit! Decompiled composables! And how sloppy use of custom views can hinder migration to Compose UI!
- 2021-08-24: 1.1.0-alpha02! Dependent modifiers! Input validation! Live text! Auto-sized text! And... performance anxiety?!?