jetc.dev Newsletter Issue #15

Published: 2020-05-26

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!

Popups

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.

CoroutineScopes and Compositions

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 CoroutineScope tied to a composition.

Composable Commentary

Posts, videos, and other new information related to Jetpack Compose!

Jetpack Compose: Compose Basics

Sagar Chapagain follows up on his earlier post with a brief discussion of the core elements of Compose, such as Column and Row.

App Theme with Compose

Brian Gardner returns, this time looking at creating custom themes based off of Compose’s MaterialTheme, along with places where you still need to adjust classic Android theme resources.

Let’s Build an Android UI with Jetpack Compose

Alex Zhukovich is back, this time with a presentation delivered to JUG Lodz and Mobile Twente on the basics of setting up a Compose-based UI.

Resource Roundup

100% pure code!

GitHub - hitherejoe/ComposeAcademy-Playground

Joe Birch has published his app showing off a wide range of samples of how to use Compose, from Material Design elements and animations through testing.

GitHub - krossovochkin/KWeather

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.

AnnotatedString and Clicks

Google’s Yacine Rezgui posted a code snippet (in a screenshot, alas) showing how to handle clicks on individual spans of text inside of a Compose AnnotatedString.

…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 androidx.ui group. These provide all of the UI elements that we use to build Android user interfaces powered by @Composable, such as Text and Column and 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”:

  • The androidx.compose artifacts 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.

  • The androidx.ui artifacts are more closely linked to Android. That link is not absolute, as the nascent ui-desktop initiative demonstrates. However, even ui-desktop is “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.


If you encounter problems in subscribing, let us know!
Spread the Word!
Suggestions?
If you have ideas for items for future newsletter editions, reach out via email or contact Mark Murphy on kotlinlang Slack!