jetc.dev Newsletter Issue #226

Published: 2024-08-06

This week, we examine text overflow and composable refactoring. We explore nested scrolling, how @Preview works, and Lottie. And we tweak system bars, since Accompanist no longer wants to.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Can I Customize Text Overflow?

The available TextOverflow options are a fixed roster, which is disappointing — it would be nice if there were an extensible mechanism for this. If you have a case where you need something other than one of the standard options (e.g., TextOverflow.Ellipsis), you can work around it with a TextMeasurer, as we see in this week’s highlighted Stack Overflow question.

How Much Is “Too Much” with Composable Refactoring?

Are there a set of rules that you can follow to create a perfect set of composables representing, say, a screen? As with many things in programming, “perfect” is both impossible and, like beauty, “in the eye of the beholder”. We get some expert thoughts on this in this week’s highlighted Kotlinlang #compose Slack thread. NOTE: No actual beholders were harmed in the creation of this newsletter.

Composable Commentary

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

Video: Nested scrolling

Google’s Simona Milanovic reviews the use of the nestedScroll() modifier and NestedScrollConnection for communications between composables that need to scroll in a coordinated fashion.

Craft Adaptable UI for Android Applications Using Jetpack Compose

Samsung’s Samiul Hossain wants us to be able to support Samsung’s line of foldables better. So, Samiul walks us through the Compose Material3 Adaptive library to offer up UIs tailored for different screen sizes, including open-posture foldables, pop-up modes, and more.

Medium: Jetpack Compose Previews: Delving Deep Into Their Inner Workings

@Preview annotations abound in our Compose projects… but how exactly do they work? Jansel Valentin explains in this post, focusing on running previews on an emulator or device. Jansel shows how to launch previews from the command line with adb… including previews of composables without the @Preview annotation.

How to Provide Accessibility in your Android App

Karol Wrótniak has published a series of four posts on Compose accessibility, covering topics ranging from minimum touch targets and color blindness to focus order and tailored semantics for TalkBack.

Compose Multiplatform + Lottie Animations

Gustavo Fão Valvassori reviews Kottie and Compottie, a pair of libraries supporting Lottie animations on Compose Multiplatform.

Medium: Material3 PullToRefresh for Jetpack Compose

Stefano Natali looks at the newly-available pull-to-refresh implementation in Compose Material3, powered by the pullRefresh() modifier, PullRefreshState, and PullRefreshIndicator().

Medium: Create widgets with Compose and Glance SDK

Alessandro Oddo walks us through creating three different app widgets powered by Compose and Glance, including responding to click events by starting activities/services or sending broadcasts.

Medium: Understanding State Management in Jetpack Compose: Concepts, Best Practices, and Examples

Prashant Singh explores the difference between stateful and stateless composables, reviews a few remember() flavors, and covers state hoisting.

Resource Roundup

100% pure code!

GitHub: stoyan-vuchev / system-ui-bars-tweaker

Stoyan Vuchev noted that we lost a lot of functionality with the deprecation of Accompanist’s System UI Controller library, so Stoyan set out to replace it. It not only offers edge-to-edge support but makes it easier to set up transparent status and navigation bars, etc.

Composables Core: Bottom Sheet

Alex Styl added a highly-configurable bottom sheet implementation to Composables Core, to help make it easier for you to match your design system requirements without starting from scratch.

GitHub: NicosNicolaou16 / PercentagesWithAnimationCompose

Nicos Nicolaou (@nicolaou_nicos@androiddev.social) brings us a series of progress indicators, including three variations of circular progress, with a lot of configuration options including animations.

GitHub: ezlifeSol / gampose

GitHub user ezlifeSol is building a series of gaming composables and related utility code for detecting collisions, virtual joysticks, and more.

GitHub: LinX64 / MVI-Library

Mohsen Rezania has released a small MVI implementation for Compose Multiplatform (Android and iOS).

Notable Releases

Circuit is up to 0.23.0, adding support for macOS, tvOS, watchOS, and Linux targets, among other improvements.

Shreyas Patil’s compose-report-to-html Gradle plugin has a 1.4.0 release, adding support for Compose Multiplatform.