jetc.dev Newsletter Issue #237

Published: 2024-10-22

We got a new patch release for production Compose, a new Compose alpha, and a stable Compose Multiplatform — let’s see what they have!

We also take a tour of droidcon NYC 2024, spend a lot of time on adaptive UIs, and review what MVI is about. Plus, we convert HTML into AnnotatedString objects, render math expressions, and see a Compose implementation of Microsoft’s Fluent design system.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

We got an updated set of BOMs for 2024.10.00:

  • androidx.compose:compose-bom:2024.10.00
  • androidx.compose:compose-bom-alpha:2024.10.00
  • androidx.compose:compose-bom-beta:2024.10.00

The production BOM contains the 1.7.4 patch release, containing a couple of bug fixes.

The alpha BOM should contain the 1.8.0-alpha04 release, which contains some performance improvements and bug fixes, along with improvements like a new containerSize property on WindowInfo (available via LocalWindowInfo).

Compose Material3’s main artifact is up to 1.4.0-alpha02, with many API changes and bug fixes.

Glance has a 1.1.1 patch release to deal with a protobuf-related security issue.

Wear Compose is out with a 1.5.0-alpha04 release, renaming LazyColumn() to TransformingLazyColumn(), adding rotary support for pagers, and more.

We also got a bunch of updates to Compose-related libraries, including:

  • androidx.activity:activity-compose:1.9.3
  • androidx.constraintlayout:constraintlayout-compose:1.1.0-rc01
  • androidx.constraintlayout:constraintlayout-compose-android:1.1.0-rc01
  • androidx.lifecycle:lifecycle-runtime-compose:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-runtime-compose-android:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-runtime-compose-jvmstubs:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-runtime-compose-linuxx64stubs:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.0-alpha05
  • androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.9.0-alpha05
  • androidx.navigation:navigation-compose:2.8.3
  • androidx.navigation:navigation-compose:2.9.0-alpha01
  • androidx.navigation:navigation-fragment-compose:2.8.3
  • androidx.navigation:navigation-fragment-compose:2.9.0-alpha01

JetBrains released the stable version of Compose Multiplatform 1.7.0. Elvira Mustafina has a blog post that runs down the changes.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Can I Manage Text Wrapping?

A common UI pattern is a Row() of text with an image on one end. You may want to keep the image and have the text fill up the remaining space, with word-wrap as needed. One approach for this is the ill-used fill parameter on the weight() modifier, as we see in this week’s highlighted Stack Overflow question.

How Can I Preview Interaction States?

@Preview is powerful, but it may require you to tweak your composable API to help it. For example, if you want to preview pressed, hovered, etc. as interaction states, your API needs to accept an InteractionSource so that the preview function can supply the states. Learn a bit more about this in this week’s highlighted Kotlinlang #compose Slack thread.

droidcon NYC 2024

droidcon NYC 2024 had a tremendous lineup of speakers and subjects, including several Compose and Compose Multiplatform presentations:

Composable Commentary

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

Creating a responsive dashboard layout for JetLagged with Jetpack Compose

Google’s Rebecca Franks walks us through how they updated the JetLagged dashboard to adapt to different window sizes, animating content as the window is resized.

Video: Custom Adaptive layouts in Compose

Google’s Alex Vanyo walks us through various approaches for implementing adaptive layouts in Compose UI, while avoiding the complexities of subcomposition most of the time.

Video: Adaptive #AskAndroid

A panel of Googlers took a series of questions in a live presentation, ranging from “What new APIs in Compose will help me build adaptive layouts?” to “How can I test my app across different devices including tablets and foldables?”

Video: Top Tech Expert Roberto Orgiu Shares Secrets for Mastering Large Screens and Foldables!

Google’s Roberto Orgiu joined the Code with the Italians team to review approaches for adaptive designs and their Compose implementations, among other topics.

Comprehensive Guide to Glassmorphism in Jetpack Compose

Muhammad Youssef reviews what “glassmorphism” means, then walks us through an implementation of a glassmorph() modifier and GlassmorphicLayer() container composable that implement a glassmorphic effect.

Medium: Exploring MVI Principles and Unidirectional Data Flow with Jetpack Compose

Ramadan Sayed gives us a deep dive into what the Model-View-Intent (MVI) architecture pattern looks like and its benefits. The post continues with a demonstration of how to implement this architecture without the support of a third-party framework like Orbit-MVI.

Implementing Overslide interaction in Jetpack Compose

sinasamaki wanted an overscroll animation on a slider, where once you reach the end the slider stretches. This turned out to be more complicated than overscroll effects on a column, and sinasamaki demonstrates how to implement it via a custom trackOverslide() modifier.

Medium: Side-effects in Jetpack Compose with Practical Examples

S.V.K Sri Charan K gives us concrete use cases for LaunchedEffect(), rememberCoroutineScope(), DisposableEffect(), SideEffect(), and SnapshotFlow.

Resource Roundup

100% pure code!

GitHub: cbeyls / HtmlConverterCompose

Christophe Beyls published a Compose Multiplatform library for Android and Desktop that converts HTML into AnnotatedString for rendering in a BasicText() or Text() composable.

GitHub: elhaouzi / CExpr

GitHub user elhaouzi released a set of composables for rendering mathematical functions, reminiscent of MathJax but without the WebView requirement.

GitHub: Konyaco/compose-fluent-ui

GitHub user Konyaco is making available a library that aims to implement Microsoft’s Fluent design system in Compose Multiplatform.

GitHub: chouaibMo / RowKalendar

Chouaib Mounaime brings us a RowKalander() Compose Multiplatform composable for rendering a single-row horizontal-paging date selector.

Notable Releases

Compose Unstyled is up to 1.7.1, adding support for Compose Multiplatform 1.7.0.

Compose Destinations is up to 1.11.7, to update its dependencies to the latest stable versions.