jetc.dev Newsletter Issue #181

Published: 2023-09-12

Compose 1.5.1, Glance 1.0.0, and lots more are in our hands, so we take a look!

We also explore publishing Compose Multiplatform libraries, configuring MaterialTheme(), and creating forms. And, we look at panning/zooming photos and adding onboarding “coachmark” hints to our UI.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

We got a lot this past week!

The Compose BOM is up to 2023.09.00. That maps to the new 1.5.1 patch release of the main Compose artifacts. 1.5.1 (and 1.1.1 of Compose Material3) contain just bug fixes, as one might expect from a patch release.

Google also shipped 1.6.0-alpha05 of the main Compose artifacts. Changes include:

  • Support for auto-mirrored icons, for cases where you want them to flip directions for right-to-left layouts

  • A new BasicSecureTextField() to match the changes from BasicTextField(), to accept an immutable value and a callback to mutate that value

  • BasicTooltipBox() was added to Compose Foundation

In the world of other Compose targets:

  • Glance shipped its stable 1.0.0 release, for all your app widget and Wear OS tile needs! 🎉

  • JetBrains shipped 1.5.1 of Compose Multiplatform, with support for Kotlin 1.9.10

  • TV Compose is up to 1.0.0-alpha09, bringing it in closer alignment with Compose Foundation and adding rememberCarouselState()

  • Wear Compose now has a 1.3.0-alpha05, with bug fixes

And, in Compose-adjacent libraries, we now have:

  • androidx.activity:activity-compose:1.8.0-beta01
  • androidx.navigation:navigation-compose:2.7.2
  • androidx.paging:paging-compose:3.2.1

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Do I Always Need to Remember?

You usually need to remember State in a composable. However, what about simple data — do we need to use remember around a simple value, or a value derived from a remembered State? Learn more in this week’s highlighted Stack Overflow question.

Why Is My Pager So Sensitive?

By default, HorizontalPager() requires a decent-sized swipe to switch pages. See how to customize the fling behavior in this week’s highlighted Kotlinlang #compose Slack thread.

Composable Commentary

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

Medium: How to write a Compose Multiplatform library (and publish it to Maven Central)

Compose Multiplatform is gaining momentum, which means there will be a need for third-party composable libraries. Shubham Singh looks at what it takes to create and publish such libraries, including how to convert a Compose Multiplatform app project into a library project, and using GitHub Actions to publish the library to Maven Central.

Medium: Theming in Compose

Maria Luiza is back, this time with a deep dive into MaterialTheme(), including looking at Material Theme Builder, supporting dynamic colors, setting up typography, and even configuring default shapes.

Medium: Jetpack compose — Cognitive overload

Vairavan Srinivasan compares and contrasts Compose UI’s approach towards animating a color with Flutter’s. Specifically, Vairavan grumbles about how using the background() modifier can have substantially worse performance than using the drawBehind() modifier, pointing out that Compose UI ought to abstract away the differences here.

Creating a Form using Jetpack Compose and Material Design 3

Waseef Akhtar walks us through creating a moderately-complex form using Compose Material3, starting with creating the project and continuing through setting up a screen composable, validating user input, integrating the classic DatePickerDialog, and employing FilterChip() for toggle options.

Medium: Accompanist System UI Controller Deprecated

Stefano Natali looks at how we can migrate from accompanist-systemuicontroller to activity-compose for supporting edge-to-edge content. This includes dealing with window insets, so your content does not wind up under your status or navigation bars.

The Do’s and Don’ts of Jetpack Compose

Savvas Dalkitsis reviews immutability, remembering values, and other aspects of state, pointing out what you should and should not do.

Resource Roundup

100% pure code!

GitHub: fornewid / photo-compose

Sungyong An offers a simple PhotoBox() composable for showing a large image, with pan and zoom support.

GitHub: pseudoankit / coachmark

Ankit Kumar brings us onboarding UI support (“coachmarks”), by means of a UnifyCoachmark() wrapper composable, which powers enableCoachmark() modifiers on individual composables to indicate what should get highlighted. This was inspired by the reveal library.

GitHub: mirego / trikot

The Mirego team is building up a suite of libraries for Kotlin Multiplatform. The trikot.viewmodels series offers multiplatform implementation of the viewmodel pattern, designed for use with Compose Multiplatform.

…And One More Thing

I just wrapped up a series of blog posts outlining the history of CommonsWare, my former business and current “hobby with a logo”. The final post explains a bit of why I started this newsletter.