jetc.dev Newsletter Issue #244

Published: 2024-12-10

This week, we see that the Compose Multiplatform train is off again, with our first 1.8.0 alpha!

We also peek at hot reloads and Presentation. Plus, we animate some sprites and render calendars on all the platforms.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

JetBrains has launched the 1.8.0 series of Compose Multiplatform with 1.8.0-alpha01. We get variable font support and improved Navigation for Compose support, but the “idle” test functions like waitForIdle() and runOnIdle() have changed and may break your tests.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Why Does My Bottom Sheet Have Wrong Values?

Modal widgets like ModalBottomSheet() render content on a layer outside of the current composable. That makes them a bit tricky to use with a LazyColumn() or other composables that work off of a collection of content. If you want to have one ModalBottomSheet() for the entire column, great! If programming it seems simpler to have one ModalBottomSheet() per item, that can work, but you need to be careful when displaying the sheet, as we see in this week’s highlighted Stack Overflow question.

Why Are My Logs Not Updating?

In programming, power tends to come with complexity. Even things designed to simplify our lives, like strong skipping and the Layout Inspector, may wind up causing confusion. See an example, where debugging-via-logging seemed to break down, in this week’s highlighted Kotlinlang #compose Slack thread.

Composable Commentary

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

Video: Hot Reload Magic

Speaking of Code with the Italians… they are back with another episode! This time, they talk with JetBrains’ Márton Braun about Firework, the work-in-progress means of offering “hot reload” capabilities to Compose development.

Medium: Using Android Presentation API with Jetpack Compose

The Presentation API has been around for quite some time in Android, allowing us to project separate app content on an external display from the content that we show on a primary display. İbrahim Ethem Şen (Mastodon) demonstrates how to have a composable power that content, owing to the fact that Presentation extends Dialog. 😭

Do DisposableEffects Always Dispose?

Vinay Gaba (Mastodon, Bluesky) treats us to a Mastodon thread exploring the limits of onDispose() in a DisposableEffect. In programming, when the question involves “always”, the answer often involves “no”, and this case fits that pattern, as a DisposableEffect could also be abandoned.

Medium: Bridging the Gap Between Jetpack Compose State and StateFlow for Reactive UI

Ioannis Anifantakis writes about the API disparity between State and StateFlow. Wanting the power of StateFlow but the simpler composable syntax of State, Ioannis proposes a toComposeState() extension function on StateFlow that lets the viewmodel keep the StateFlow while exposing State to the composables.

Testing Different Navigation Options with Compose

Eevis Panula (Mastodon, Bluesky) returns, looking at writing instrumented tests, exercising a variety of user input patterns: simple clicks, swipe events, and keyboard input.

Animated Text Field Hint in Jetpack Compose

Sinasamaki (Mastodon, Bluesky) walks us through how to use shared element transitions to move text from the hint position in a text field to a label position above that field, an animation made famous in Android by some of the original work on Material Design.

Resource Roundup

100% pure code!

GitHub: stevdza-san / SpriteView-KMP

Stefan Jovanovic published a SpriteView() composable that renders animations based on cells in a sprite sheet (or texture atlas). You supply the sheet and details, and SpriteView() handles decoding the sheet and animating between individual images.

GitHub: WojciechOsak / Calendar

Wojciech Osak offers a Compose Multiplatform calendar, with single-date, multiple-date, or range selection, month or week views, and more!

Notable Releases

Horologist has 0.6.21 and 0.7.7-alpha releases, improving ambient support.

Maps for Compose is up to 6.4.0, bumping the compileSdk to 35.