jetc.dev Newsletter Issue #43

Published: 2020-12-08

Compose is up to alpha08, so this week we explore what that means. We also peek at the new “Arctic Fox” edition of Android Studio, try to remember when we need to remember(), and look at design systems and themes. Plus, we get yet another reminder that we need to be patient as Compose has its API reviewed and standardized.

Reminder: Compose alpha08 requires Kotlin 1.4.20, whereas previous versions did not support 1.4.20. Also note that androidx.ui packages, such as ui-tooling and ui-test, are now in the androidx.compose.ui artifact group.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Scaffold with TopAppBar Integration with Navigation

Using Navigation for Compose seems like a natural fit for a Scaffold()-based UI. However, ideally, if you are showing a drawer, the top bar icon switches from a menu (to open the drawer) and a back arrow (if the user can navigate back/up). A bit of state can help us switch between those icons, as we see in this week’s highlighted Stack Overflow question.

Is It Necessary to Remember?

remember() seems important. However, it is not necessarily always clear what should and should not be wrapped in remember() to retain an object across compositions. In this week’s highlighted Kotlinlang Slack thread, we explore that issue and its relationship to derivedStateOf() and snapshots.

Composable Commentary

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

Android Studio Arctic Fox 2020.3.1 Canary 1

A week ago, Google updated Android Studio 4.2 to its first beta release. The Tools team elected not to continue Compose @Preview support in the 4.2 betas, akin to how they dropped it from 4.1 earlier. As a result, your choice is to either stick with the final canary build of 4.2 or jump into Android Studio 2020.3.1, code-named “Arctic Fox”. This IDE, formerly known as Android Studio 4.3, uses the new IDEA-based very wordy naming-and-numbering system. It is the new home for Compose @Preview support… at least in theory (early reports indicate that there are some bugs).

Compose Runtime Alpha 08 Release Notes

Lint is going to start yelping about adhering to Compose API guidelines, specifically about the names and positions of composable function type (lambda) parameters. In particular, the trailing lambda parameter is supposed to be named content. Also, ambients now get Ambient as a prefix, not a suffix.

Compose Foundation Alpha 08 Release Notes

maxLines had hardly showed up for CoreTextField when it got moved to BasicTextField. On the flip side, we now have singleLine for BasicTextField and related composables. A bunch of other things are getting renamed (e.g., VectorAsset is now ImageVector), and a bunch of deprecated things are outright removed (e.g., Stack, Border, Modifier.gravity()). We have better gesture detector support, plus a slew of bug fixes and other changes.

Compose UI Alpha 08 Release Notes

A seemingly infinite number of things are being renamed, moved into new packages, or both. We now can find out what modifier keys (e.g., Shift) were pressed when a key event occurs. Even more gesture detectors were added, including ones based around multitouch (e.g., pinch-to-zoom).

Jetpack Compose for Desktop: Milestone 2 Released

JetBrains continues their own release train, with a new build of Compose for Desktop for us to play with! It now supports macOS 10.13 and higher, plus supports the new Apple Silicon. There is better interoperability with Swing code, and vector drawables are now supported.

Migrating Your Design System to Jetpack Compose (Part 1)

Adam Bennett returns with the first part of a blog post series looking at design systems and their Compose implementations. Specifically, he reviews how his team took their existing design system for classic views and how how they approached creating a Compose counterpart.

Crouching Theme, Hidden DI

Bill Phillips reviews three theming mechanisms: classic Android resource-based themes,
a custom themeing system that Cash created for their app, and Compose UI’s theming system. He provides samples plus pros and cons for each approach, working from the basis that themes are dependencies to be injected into app code.

Jetpack Compose: Navigation

Sumit Mishra gives us a quick tour of Navigation for Compose, to navigate through a set of composables implementing different screens.

Video: Compose Your Next App

Himanshu Singh recorded a webinar, mostly in the screencast style, exploring a wide range of Compose topics, from the basics through interoperability with classic views and writing UI tests.

Resource Roundup

100% pure code!

GitHub: p-hlp / InTimeAndroid

GitHub user p-hlp brings us InTime: an interval (or countdown) timer written using Compose UI and Navigation for Compose, along with other Jetpack components.

GitHub: kmadsen / adb-desktop

Kyle Madsen is working on a Compose for Desktop adb client, for controlling devices and emulators from a GUI instead of just the CLI. Right now, it mostly helps you manage wireless ADB connections.

…And One More Thing

The renaming and refactoring is continuing at a brisk pace, and we should expect more of the same in upcoming alphas.

The good news is that these decisions are being made by an “API council”. Presumably, that group is responsible for setting naming standards, helping to identify what needs to be changed, and dealing with one-off naming concerns.

The release notes suggest that they are codifying their naming standards, which will add some measure of predictability to upcoming changes. Plus, for “new construction”, hopefully they will use these standards at the outset and therefore be less likely to have to be altered later.

Still, this makes keeping up with the alpha releases annoying — each new update means a new round of figuring out what is moved, what is deprecated, etc. This time around, that is on top of having to decide which Android Studio version to use (4.2 Canary 16? 4.2 Beta 1? 2020.3.1 Canary 1 Arctic Fox “Omaha!”?)

As always, patience is the watchword.