jetc.dev Newsletter Issue #231

Published: 2024-09-10

Compose 1.7.0 and Wear Compose 1.4.0 released! And, as usual, fresh alpha releases also came out, so we see what we got!

We also watch a lot of droidcon Berlin 2024 videos, hear from Google about edge-to-edge, and think about circular layouts.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

The Compose 2024.09.00 edition of the BOM points to the final 1.7.0 main artifacts, plus the 1.3.0 versions of Compose Material3. There are also 2024.09.00-alpha and 2024.09.00-beta BOMs, though they appear to be undocumented.

In addition to the 1.7.0 final edition of Compose, Google released 1.8.0-alpha01, with no release notes of note.

Compose Material3 Adaptive is up to a stable 1.0.0 release.

Wear Compose has a stable 1.4.0 release and a 1.5.0-alpha01 release. That alpha includes:

  • A LazyColumn() specific to Wear Compose
  • Support for letter spacing on curved text
  • A bunch of bug fixes

In Compose-adjacent items, we have some new artifacts for using CameraX in Compose:

  • androidx.camera:camera-compose:1.5.0-alpha01
  • androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha08

…and we also got these updates:

  • androidx.activity:activity-compose:1.10.0-alpha02
  • androidx.activity:activity-compose:1.9.2
  • androidx.constraintlayout:constraintlayout-compose:1.1.0-beta01
  • androidx.constraintlayout:constraintlayout-compose-android:1.1.0-beta01
  • androidx.fragment:fragment-compose:1.8.3
  • androidx.lifecycle:lifecycle-runtime-compose:2.8.5
  • androidx.lifecycle:lifecycle-runtime-compose:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-runtime-compose-android:2.8.5
  • androidx.lifecycle:lifecycle-runtime-compose-android:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-runtime-compose-desktop:2.8.5
  • androidx.lifecycle:lifecycle-runtime-compose-jvmstubs:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-runtime-compose-linuxx64stubs:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5
  • androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-viewmodel-compose-android:2.8.5
  • androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.0-alpha02
  • androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.8.5
  • androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.9.0-alpha02
  • androidx.navigation:navigation-compose:2.8.0
  • androidx.navigation:navigation-fragment-compose:2.8.0

And JetBrains released 1.7.0-beta01 of Compose Multiplatform. This makes some changes to iOS interop, adds a new material-navigation module, adds desktop support for input methods to BasicTextField(), adds test resources support, and more!

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Alas, the Slack archive for Kotlinlang is still not working. If this situation persists, I may start summarizing threads again, as I used to in the early days of this newsletter.

Why Do I Keep Getting the Same Viewmodel?

By default, your Jetpack ViewModel instances are scoped to the activity or fragment hosting your composables. Unless you supply a key to the viewModel() function, you will get the same viewmodel instance for different screens, if those screens are just composables in the same activity or fragment and you are not using something else like Navigation for Compose. Learn more in this week’s highlighted Stack Overflow question.

droidcon Berlin 2024

The videos for droidcon Berlin 2024 dropped, and there are quite a few with a Compose focus, including:

Composable Commentary

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

Medium: Insets handling tips for Android 15’s edge-to-edge enforcement

Google’s Ash Nohe reviews Android 15’s change for edge-to-edge presentation to be opt-out rather than opt-in, once your targetSdk rises to 35. Ash then reviews various techniques for adapting to edge-to-edge presentations while not putting important content in inappropriate areas, including relying on Compose Material’s Scaffold() and its supplied PaddingValues.

Medium: Preview and test your app’s edge-to-edge UI

Google’s Meghan Mehta explores how to preview composable screens in an edge-to-edge presentation, leveraging some features only available in the Ladybug preview editions of Android Studio.

Medium: Type safe navigation for Compose

Google’s Don Turner walks us through type-safe navigation in Navigation for Compose. Don also reviews the tweaks that were made during the alpha period, such as support for enums.

Medium: SwiftUI vs Jetpack Compose: A Guide for Cross-Platform UI Development

Omar Mujtaba reviews a series of SwiftUI constructs, such as VStack and @State, and ties them to Compose equivalents (e.g., Column() and remember), to help iOS developers making the move to Compose.

Medium: Mastering TextDirection for Multi-Language Apps in Jetpack Compose

ilyas ipek looks at the textDirection property of TextStyle, how it relates to the current LayoutDirection, and what its default behavior is.

Medium: Crafting Circular Presentations in Jetpack Compose: A Look into Layouts and Measurement Policies

Sometimes, you want to lay out composables not in a row or a column, but instead an arc or a circle. For example, you might want a radial menu when the user taps on a floating action button. Kerry Bisset explores how to implement this, in the form of a circularMeasurePolicy for use in Layout(), wrapped in a Circular() container-style composable.

Google Maps in Jetpack Compose: Getting Started

Joe Birch takes a look at Maps for Compose, showing the GoogleMap() composable, rememberCameraPermissionState(), MapUiSettings, and MapStyleOptions.

Resource Roundup

100% pure code!

GitHub: JaberAhamed / StackCarouselCompose

GitHub user JaberAhamed has published a StackCarousel() composable, for Tinder-style swipe cards, with customizable animations. See this Medium post for more.

GitHub: amit-bhandari / Draggable-Layout-Compose

Amit Bhandari created a getDraggableModifier() modifier that lets you enable drag gestures on arbitrary composables, with control over the drag direction, snap behavior, and more.

Notable Releases

Accompanist is up to 0.36.0, mostly to tie into the stable 1.7.0 release of Compose.

Maps for Compose is up to 6.1.2, with a couple of bug fixes.