jetc.dev Newsletter Issue #81
Published: 2021-09-07
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
of SideEffect
. We debug excessive recomposition, look at sharing a KMP library
of composables with an Android app, and rendering grids and timelines.
Alpha Analysis
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.
Beyond that:
-
The compiler plugin now supports older versions of the runtime, whereas previously the plugin and runtime libraries had to match versions
-
A new
OverScrollConfiguration
option gives us glow effects for overscrolls -
ViewConfiguration
now offers a minimum touch target size
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Parcelable Arguments in Navigation
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.
Why Do We Need SideEffect
?
One of the more confusing aspects of Compose is the need for the ...Effect
composables. See one take on where and how to employ a SideEffect
in this week’s
highlighted Kotlinlang #compose
Slack thread!
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Medium: Understanding re-composition in Jetpack Compose with a case study
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!
Medium: Using KMP Compose libraries in Android Apps
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.
Medium: Jetpack Compose navigation architecture with ViewModels
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
with @Preview
, and more!
Medium: Basic Drag-n-Drop in Jetpack Compose
Suraj Sao walks through an implementation of drag-and-drop for row reordering in
a LazyColum()
, using long-click gestures to trigger the drag-and-drop behavior,
moving the row being dragged, and handling overscroll.
Jetpack Compose: Building Grids
Alex Zhukovich returns, looking this time at the experimental LazyVerticalGrid()
composable, as well as “classic” ways of creating grids using a mix of Row()
, Column()
,
LazyRow()
, and LazyColumn()
. UI patterns demonstrated here include galleries and HTML-style
tables.
Video: Accompanist and Navigation transitions — with Chris Banes
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.
Video: Building a Production-Ready Chat SDK Using Jetpack Compose
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.
Formatting credit card number input in Jetpack compose Android
Benyam works through adding a VisualTransformation
to an OutlinedTextField()
for formatting credit card numbers, based on the card type, including an automatic
checksum to detect simple typos.
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
Resource Roundup
100% pure code!
GitHub: jisungbin / ComposeTimeLineView
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.
GitHub: rohitjakhar / Kuberam
Rohit Jakhar created an extensive app for tracking personal financial transactions, with Compose UI, Firestore, Auth0, and more.
GitHub: kaleidot725 / ExifReader
Yusuke Katsuragawa created a simple Compose UI app that displays a photo gallery and displays EXIF details for the photos.
…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
TextField
focus 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
androidx.security:security-crypto
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.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-10-29: Relay! Paparazzi! droidcon Lisbon 2024! Server-defined UI! And... desktop OS trays?!?
- 2024-10-22: Compose patch! Compose alpha! Compose Multiplatform stable! droidcon NYC! Adaptive UIs! MVI! HTML conversions! Math rendering! And... are we now Fluent in Compose?!?
- 2024-10-15: Alpha and beta BOMs! Compose Multiplatform UI testing! Compose Multiplatform camera apps! Passing data between screens in Navigation for Compose! JSON rendering!