jetc.dev Newsletter Issue #15
In this week’s issue, we will look at scoping coroutines to a composition, customizing your Compose UI theme, and responding to clicks in rich text. Plus, we will explore what “Jetpack Compose” really refers to… as it depends on who you ask.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Having menus that pop up or drop down is fairly commonplace, even in mobile
app development. One Compose UI solution for this is
DropdownPopup, as illustrated
in this Stack Overflow question and answer.
Now that Compose and coroutines work better together, developers are starting
to explore the possibilities and are trying to determine how best to blend
the two together. This led to a lengthy discussion of how to have a
tied to a composition.
Posts, videos, and other new information related to Jetpack Compose!
Sagar Chapagain follows up on his earlier post
with a brief discussion of the core elements of Compose, such as
100% pure code!
GitHub user krossovochkin has a weather app, written on a Kotlin Mutiplatform foundation, using Compose for the Android UI. As you might guess from the project name, it shows the weather for user-selected cities.
…And One More Thing
What “Jetpack Compose” is depends on who you ask.
To some, particularly core developers on the project, “Jetpack Compose” is
the foundation set of artifacts in the
androidx.compose group. These are
what power the
@Composable annotation and involve all the skip lists and
other data structures that Leland Richardson has covered in a few presentations.
To others, “Jetpack Compose” is more about the artifacts in the
group. These provide all of the UI elements that we use to build Android
user interfaces powered by
@Composable, such as
AdapterList and so on.
Right now, I suspect that the second group is far larger. However, that leads to some confusion from time to time.
For example, there has been discussion about whether Jetpack Compose will become cross-platform. The ramification of “cross-platform” in this case depends a lot on the definition of “Jetpack Compose”:
androidx.composeartifacts are not tied very much to Android. With some difficulty, they can be used today in other scenarios, such as the server-side Web app mentioned in the last issue. It would not surprise me in the least if these artifacts eventually become full-fledged Kotlin/Multiplatform libraries and could be used completely independently from Android app development.
androidx.uiartifacts are more closely linked to Android. That link is not absolute, as the nascent
ui-desktopinitiative demonstrates. However, even
ui-desktopis “simply” trying to get the stock Compose UI composables to render to a desktop canvas instead of an Android canvas. So, not only do we have to worry about providing non-Android alternatives for things like resources, but we have to consider whether a Material Design-styled UI would work on other platforms. On the desktop, Material Design is perfectly reasonable. On iOS, Material Design would be extremely odd, if it were even allowed to be used.
So, be careful about broad statements like “Jetpack Compose will be cross-platform”. The Compose the statement refers to might not be the Compose that you are thinking of.
- 2021-07-20: rc02! Preview and ViewModel, together again! Coil supports Compose! MVI! @dequesystems on accessibility! Screenshots of composables! D-pad support! And... Context code smells?!?
- 2021-07-13: Focus! Viewports! Navigation! @divyajain2405 talks about architecture! Screenshot testing! Sliders! Reorderable lists!
- 2021-07-06: RC01! Navigation! Phones *and* tablets! Cards! Timers! Barcodes! And... the