Newsletter Issue #141

Published: 2022-11-15

We got a patch release of Compose, plus a new alpha, and an RC for Wear Compose!

Beyond that, we watch what was presented at the second phase of the Android Developer Summit plus the October 2022 edition of Android Worldwide. We look at lazy lists, permissions, and drawing text. Plus, we showcase a showcase.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

The 2022.11.00 edition of compose-bom was released, mostly to pull in the 1.3.1 patch releases of the Compose artifacts. This patch contains just a handful of bug fixes.

Compose Compiler has a 1.4.0-alpha02 release, with Kotlin 1.7.21 support.

The rest of the Compose artifacts are also up to 1.4.0-alpha02. Changes include:

  • A new minLines parameter on BasicText() and BasicTextField(), for those who are building their own non-Material design system

  • The same minLines parameter on Text(), TextField(), and OutlinedTextField(), for those using Compose Material

  • A Paint constructor that takes an Android platform Paint parameter, and FontFamily.Resolver.resolveAsTypeface() function to convert a FontFamily into a Typeface, for more interop options with the classic View system

Wear Compose is up to 1.1.0-rc01, with a long list of bug fixes.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Do I Select All the Text?

Normally, the user handles text selection manually with a TextField() or BasicTextField(). But, from time to time, you might need to adjust the selection yourself. See how you can use TextFieldValue and TextRange for this, in this week’s highlighted Stack Overflow question.

Can a ViewModel be @Stable?

For that matter, should a ViewModel be @Stable? The answer may be “yes”, at least in some circumstances, such as a composable-scoped viewmodel. Learn more in this week’s highlighted Kotlinlang #compose Slack thread.

Android Developer Summit 2022, Part Deux

The Android Developer Summit for 2022 is a three-event affair. The second part was focused on “form factors”, looking at how to get your app to other devices beyond phones. Presentations related to Compose included:

Android Worldwide

The Android Worldwide October 2022 event included a handful of Compose-related presentations, including:

Composable Commentary

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

Android Developers Backstage: Compose Lazy Layouts

Google’s Rebecca Franks and Chet Haas hosted a podcast with Andrey Kulikov, Matvei Malkov, and Andrei Shikov, covering the use of LazyColumn(), LazyRow(), and the rest of the lazy containers in Compose UI.

Medium: A Foray into Relay

Jamie Samson plays around with Relay, the pair of plugins that lets you convert Figma components into composables. Jamie specifically looks at how to deal with Compose themes, as there may not be a direct mapping from Figma to your design system. And Jamie also looks at some potential issues with Relay, such as adding Figma as the system of record for your actual code.

How to Request Permissions in Jetpack Compose (2 Ways)

The SemicolonSpace team explores two approaches for requesting runtime permissions from users: rememberLauncherForActivityResult() and Accompanist’s permissions API.

Medium: Exploring text on Canvas using drawText API in Jetpack Compose

Radhika S looks at drawText(), a recent addition to the Canvas() DSL that lets you render text directly on the canvas. Radhika examines all four forms of the experimental drawText() function to see what options they offer.

Show BottomBar conditionally in Compose

You might have a BottomBar() as part of your navigation setup, but you might not want that bar all the time as the user navigates deeper in your app. James Shvarts explores what it takes to hide that bar, using some state to indicate whether the BottomBar() should be included in the composition.

Resource Roundup

100% pure code!

GitHub: SimformSolutionsPvtLtd / SSComposeShowCaseView

The Simform Solutions team implemented a showcase, to highlight a particular UI element and explain its use. Their library gives us ShowcaseProperty to capture the particular area to highlight and a ShowCaseTarget() composable to render the showcase.

Gist: alexstyl / AutoCompleteTextComposable.kt

Alex Styl demonstrates how to use an ExposedDropdownMenuBox() combined with a TextField() to implement the basics of a Compose UI equivalent of the classic AutoCompleteTextView widget.

GitHub: yml-org / YCharts

The yml-org GitHub user brings us a large library of chart composables, for pie, donut, line, bar, and grouped bar charts.

GitHub: mxalbert1996 / compose-shared-elements

Albert Chang forked and updated a library mentioned here way back in issue #8, to help implement shared element transitions as users navigate from screen to screen within your app.