jetc.dev Newsletter Issue #251

Published: 2025-01-28

This week, we seek greater control over the effects of visibility and inset animations. We put the spotlight again on integrating the camera and try out screenshot testing. And we play videos on (almost) all the Compose platforms.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

JetBrains released 1.8.0-alpha02 of Compose Multiplatform. This mostly seemed focused on bug fixes, plus iOS drag-and-drop support and accessibility improvements.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Can We Animate All the Impacts of Hiding and Showing?

We can use AnimatedVisibility() to animate the hiding and showing of a composable. However, the animation really only affects that composable; everything else around it does a “smash cut” transition at the end of the animation. Doing something more sophisticated is possible — we see two examples in this week’s highlighted Stack Overflow question.

Can We Control Which Composables Move on Inset Changes?

When the IME (a.k.a., soft keyboard) opens and closes, an associated inset expands and contracts. We can arrange for our composition to take that into account and slide out of the way of being obscured by the IME. However, if we want to have detailed control over exactly how far things slide out of the way, we have more work to do, as we see in this week’s highlighted Kotlinlang #compose Slack thread.

Composable Commentary

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

Medium: Create a spotlight effect with CameraX and Jetpack Compose

Google’s Jolanda Verhoef (Mastodon, Bluesky) continues her series on working with the native Android camera in a Compose for Android project. This time, she uses face detection to identify faces in the camera preview. She then transforms image sensor coordinates into the Compose coordinate space, to be able to overlay composables on the preview while taking the faces into account.

Video: Integrate Google Pay with Jetpack Compose on Android

Dominik Mengelt and Jose Ugia from the Google Pay team demonstrate how to use the Google Pay button for Jetpack Compose.

Video: How ‘Hot Reload’ is implemented for Compose

JetBrains is working on “Hot Reload” — the ability for an IDE preview to update quickly as code is being edited. JetBrains’ Sebastian Sellmair (Mastodon, Bluesky) gives us a tour of its implementation.

Medium: Widgets with Glance: Displaying Images

Katie Barnett returns to the world of Glance, this time explaining displaying images from drawable resources or URL-based sources. For images from the network, Katie shows how to use a CoroutineWorker to update the Glance app widget in unison once the image is ready to display.

Compose Preview Screenshot Testing test drive

Anil Kumar Beesetti and Mike Yerou tried out Google’s tool for screenshot testing. They had good luck in integrating it with GitHub actions but encountered some cross-platform problems owing to slight differences in how platforms render composables.

Medium: Creating a Kotlin DSL for Jetpack Compose Components

We are used to passing a long parameter list to a composable. Rafael Henrique Fernandes demonstrates how to convert that parameter list into a DSL that populates a configuration object, which in turn is used by the composable.

Medium: How to get Activity in Compose

Viktor Mykhailiv points out that androidx.activity:activity-compose:1.10.0 introduced a LocalActivity composition local, to be able to get at the activity that is rendering this composition. Viktor also shows how to backport this implementation, in case for some reason you are not in position to use 1.10.0 or higher.

Resource Roundup

100% pure code!

GitHub: kdroidFilter / Compose-Media-Player

GitHub use kdroidFilter has created a Compose Multiplatform video player wrapper for Android and desktop platforms. It supports local and remote media, offers customizable media controls, and more!

GitHub: mejdi14 / KMP-Searchable-Dropdown

mejdi hafien created a SearchableDropdown() composable, for a drop-down menu with optional searching within the supplied list of content objects. It supports single- and multiple-selection modes, a fair bit of visual customizing (based on Compose Material), and support for Compose Multiplatform.

GitHub: agent-polyblank / ComposeExtendedFab

Sam King brings us another implementation of the floating action menu pattern, where a FAB expands into a menu when clicked. This supports Compose Multiplatform for desktop, iOS, and Web/Wasm.

GitHub: nassendelft / compose-win9x-theme

Nick Assendelft has gone back in time and has created a Compose design system that mimics the look and feel of Windows 95. It even supports Compose Multiplatform, presently for Android, desktop, and Web/Wasm. I eagerly await somebody creating the MS-DOS design system, or possibly the IBM 3270 “green screen” design system, to further the retro-UI movement. (yes, I’m old)

Notable Releases

Maps for Compose is up to 6.4.2, with a cluster rendering bug fix.