jetc.dev Newsletter Issue #122

Published: 2022-06-28

We already have 1.2.0-rc02!

In addition, we look at activity labels and coroutine scopes. We explore Lint rules, fragments in composables, and a TwoPaneLayout. We see libraries for Markdown, release notes, and onboarding.

And I am very happy to see that JetBrains bought some linen. Seriously.

RC Reflections

Reviewing the release notes for the latest Jetpack Compose update!

The ink had barely dried on RC01 releases for Compose and Wear Compose, and we get RC02!

Compose 1.2.0-rc02 has very little in it, most notably removing the ExperimentalEasingApi from some easing functions in Compose Animation.

Wear Compose 1.0.0-rc02 has a few fixes to card and chip gradients, and not much more.

Stable releases for both seem imminent!

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Do We Get Our Activity’s Label?

An <activity> manifest entry can have an android:label attribute. That might be useful for a TopBar(), but our composables usually are not member functions of an activity. See how to load that label in this week’s highlighted Stack Overflow question.

How Do We Choose the Right Scope?

We have rememberCoroutineScope(), and we have LocalLifecycleOwner.current.lifecycleScope. Which should we use, and when? Learn the scope of those scopes in this week’s highlighted Kotlinlang #compose Slack thread!

Composable Commentary

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

Which lint rules does Jetpack Compose ship with?

Vinay Gaba was wondering what all the Lint rules were that might help Compose developers write better composables. He found a few dozen and shows you how to find them and how to adjust their severity to fit your team’s needs.

Compose sample app: UI state with Flow, offline first

James Shvarts walks us through a sample app that renders lists and grids of movie posters, including swipe-to-refresh, leveraging Flow, Room, and Compose UI.

Jetpack Compose TwoPaneLayout update

Microsoft has been maintaining a library of composables designed for the Surface Duo and other dual-screen foldables. In this post, Joy Liu and Kristen Halper outline some recent changes to TwoPaneLayout that affect navigation, to offer more flexibility while also reworking the API to be a bit more scope-centric.

Medium: Load Fragments in Jetpack Compose: Beyond What Google Taught

A fragment-centric app can be migrated to Compose UI in a bottom-up fashion, converting each fragment to use Compose UI internally. In this post, Elye focuses on the other direction: a top-down migration that converts the activity to Compose UI before it converts that activity’s fragments. This requires composables to manipulate fragments, and Elye explores the issues with four solutions before settling on a fifth.

Building Accessible Android Apps with Jetpack Compose

Devanshu Chandra looks at how to use modifiers like semantics() to help connect composables to the accessibility framework.

Custom Toast in Android using Jetpack Compose

Toasty is a library for displaying customized Toast-style popups. Geeks for Geeks member chaitanyamunje contributed a post showing how to integrate that library with Compose UI, to show those popups as needed from composables.

Medium: Performance best practices for Jetpack Compose (GoogleIO 2022 recap)

Medium user BattleShip Park walks us through some of the performance-related recommendations coming from Google I|O, from remember() and derivedStateOf() to LazyList keys and deferring state reads.

Resource Roundup

100% pure code!

GitHub: Resaca Hilt

Sebas LG created a way to have Jetpack ViewModel instances per composable via Hilt.

GitHub: Yazan98 / Markdown-Compose

Yazan Tarifi brings us another Markdown rendering library, in the form of a MarkdownViewComposable() with a MarkdownConfig class for defining whether links work, if the results are scrollable, etc.

GitHub: sebastinto / bulletin

GitHub user sebastinto created a BulletinScreen() composable to render a screen for release notes for your app.

GitHub: cyeksan / onboarding

Cansu Aktaş offers an OnboardingScreen() for a page-at-a-time onboarding flow, design for first-time use of an app or some feature.

…And One More Thing

One of my long-term gripes about Kotlinlang Slack as the primary Compose support point is that “what happens in Slack, stays in Slack”. Slack is invite-only and unindexable by search engines. While JetBrains seems to do a good job with processing requests to join, a mandatory registration process just to read adds a lot of friction.

That just changed.

JetBrains is now using Linen, a SSaaS (Slack Surfacing as a Service) offering. Linen simply does what Slack itself should be doing: having a read-only publicly-searchable copy of the contents of a should-be-public Slack workspace.

Specifically, https://slack-chats.kotlinlang.org contains an archive of all Kotlinlang Slack channels, including key ones like #compose. Individual threads get their own pages, such as this one about Vinay Gaba’s work in identifying Compose-related Lint rules. There were a few hiccups at the time of launch, but right now the site is very responsive.

This is awesome. I am pleased beyond words that JetBrains is doing this and that Linen exists. And, it has a slight impact on this newsletter: I can now start linking to Linen pages for the Slack threads that I highlight in “One Off the Stack, One Off the Slack”.

Kotlinlang-on-Linen is a very welcome development, and I look forward to the Compose ecosystem using this in interesting ways!