jetc.dev Newsletter Issue #238

Published: 2024-10-29

This week, we try to determine when our screen is destroyed and how far @Stable really goes. We explore Relay and Paparazzi. And we look at a server-defined UI implementation and integration with desktop OS trays.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Note that the Slack archive for Kotlinlang seems to be stuck again, with no updates after October 23rd. This may affect future newsletter issues.

How Do I Determine When My Screen is Destroyed?

Asking this question “opens a can of worms”, as “destroyed” is not strictly a thing in a single-activity Compose-based UI. You need to tie your logic to something else, such as a Jetpack viewmodel being cleared, as we see in this week’s highlighted Stack Overflow question.

Do I Seem @Stable Enough?

We can declare an interface to be @Stable. Beyond the @Stable contract, what restrictions are there placed on our implementations of the interface — for example, can we create an anonymous instance via object? Learn more in this week’s highlighted Kotlinlang #compose-android Slack thread.

droidcon Lisbon 2024

droidcon Lisbon 2024 had several Compose-related talks, including:

Composable Commentary

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

Video: Studio Jewelry - Android Developers Backstage

This Android Developers Backstage episode features Google’s Sebastiano Poggi, with a discussion of where Compose for Desktop gets used in building Android Studio. They also take a look at the JetBrains Jewel design system and its Markdown renderer.

Bridging the Gap: Turning Figma Designs into Jetpack Compose Code with Google‘s Relay Plugin

Shane Barker reviews applying Relay to convert a Figma design to Compose code using a specific design system. Shane explains the good and the bad, from the style of the generated code to the performance of the result.

Medium: Why Espresso UI Tests are Holding Your App Back: Discover the Power of Paparazzi Snapshots!

Raphael Cohen gives us a tour of Paparrazi for screenshot-based composable testing, from writing the tests to storing the “golden images” to detecting test failures.

Circular Reveal Animations in Jetpack Compose

Scott Pierce demonstrates how to transition from UI state to state with a circular reveal emanating from the point where the user taps a widget. The trick involves drawing two copies of the composable (initial state and end state) and animating a circular clip.

Jetpack Compose Modifiers: Your Swiss Army Knife for UI Enhancement

The Wawandco team is back, this time giving us a tour of dozens of modifiers and how to use them for various effects.

Medium: Loading Initial Data in Jetpack Compose: Effective Strategies for Your UI

Muhamed Riyas M walks us through three approaches for loading data when you open up a screen: SharingStarted.WhileSubscribed on a Flow, LaunchedEffect(), and a simple init() function in a viewmodel.

Resource Roundup

100% pure code!

GitHub: vvsdevs / AndroidDynamicJetpackCompose

GitHub user vvsdevs is building a server-defined UI engine based on Compose Material3.

GitHub: easternkite / eungabi

Lee Dong-Yeon is working on a Compose Multiplatform navigation library, with an eye towards supporting platform-specific UX, such as Android’s predictive back gesture and iOS’s swipe-back gestures.

GitHub: kdroidFilter / ComposeNativeTray

GitHub user kdroidFilter is creating a Compose for Desktop library to allow apps to integrate with the system tray on Linux, macOS, and Windows. It supports tray menus defined by a DSL with items, checkable items, sub-menus, dividers, and more.

GitHub: huanshankeji / compose-html-material

GitHub user huanshankeji has published a library of Material3 components based on Compose HTML. This related library aims to create a unified API for Compose HTML and the Compose Multiplatform set of platforms.

Notable Releases

Circuit is up to 0.25.0, mostly updating dependencies.

Compose Unstyled is out with a 1.18.1 release, with some improvements to BottomSheet(), ModalBottomSheet(), and Dialog().

Also, the ImageVector Wizard plugin now supports IntelliJ IDEA in addition to Android Studio and was rewritten in Compose for Desktop.