jetc.dev Newsletter Issue #126
Published: 2022-08-02
Compose 1.2.0 shipped in stable form, as did Wear Compose 1.0.0! 🎉
Beyond that, we look at gradient-filled text and supporting foldables. We examine a drag-and-drop library and faster screenshot tests. And I look at where we are with respect to the Compose release cadence and community adoption.
Alpha Analysis
Reviewing the release notes for the latest Jetpack Compose update!
In addition to the stable releases, Compose Compiler 1.3.0 is already up to an
RC! The rest of Compose is out in a 1.3.0-alpha02
edition, including:
-
A new experimental
TextMeasurer
to report the size of text, without rendering that text -
Support for touch input pressure via
PointerInputChange
-
Added
drawText()
onDrawScope
for use with things likeCanvas()
anddrawBehind()
-
Your usual assortment of bug fixes
Wear Compose also has an alpha02
(1.1.0-alpha02
), moving their dependencies
up to Compose 1.3.0’s alpha and adding support for varying chip shapes.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Does a 0dp Sized Composable Even Get Composed?
With all of the optimizations within Compose and Compose UI, you might think that they would have optimized away composables with no height or width. In truth, they do get composed, and this Stack Overflow question explores why that is the case and how to demonstrate the behavior.
Animating Changes to a Column()
A lot of people have been working on animating additions to and removals from
lazy containers like LazyColumn()
. But, how do you do the same thing with a regular
Column()
? Learn more in this week’s highlighted Kotlinlang #compose
Slack thread!
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Jetpack Compose 1.2 is now stable!
Google’s Jolanda Verhoef posted the official announcement of the stable release of Compose 1.2.0, reviewing the major API additions, new experimental APIs, and significant bug fixes.
Compose for Wear OS is now 1.0: time to build wearable apps with Compose!
Google’s Kseniia Shumelchyk brings us the official announcement post for the stable release of Wear Compose 1.0.0. Of particular note, Google states:
Moving forward, Compose for Wear OS is our recommended approach for building user interfaces for Wear OS apps.
This is a fairly strong statement and suggests that Wear Compose is likely to continue receiving updates in the future.
Medium: Brushing up on Compose Text coloring
Google’s Alejandra Stamato writes about applying gradients to text, including
both the Brush
support for TextStyle
and SpanStyle
in Compose 1.2.0 and
previous techniques for those not ready to yet move to the now-latest stable release.
Video: Making Adaptable apps using Material 3 and Jetpack Compose
Google’s Gurupreet Singh explores supporting larger-screen devices, such as tablets
and foldables, using Compose UI, in this Android Worldwide video. Tips include
using calculateWindowSizeClass()
to display a UI suitable for the current screen
size and leveraging device posture support to determine how to deal with foldables.
Video: Animations with Compose!
The Code with the Italians team continues a string of Google guests! This time,
Doris Liu drops by to talk about animations in Compose, with particular emphasis
on LookaheadLayout()
.
Drag and drop library for Jetpack Compose
Microsoft continues their first-class support for Compose UI, with an eye towards supporting their Surface Duo devices. This time, Joy Liu tells us about the new DragAndDrop addition to the Microsoft Compose SDK, to help make it easier to write drag-and-drop UIs both between multiple panes of a single app and between multiple apps.
Improving Compose snapshot tests with Paparazzi
Anders Ullnæss previously wrote about using Shot for screenshot testing, but he found that it runs slowly due to the need to run on hardware or an emulator. In this post, Anders explores using Paparazzi for screenshot testing, as it does not require either a device or an emulator.
Case study – Mosaic for Jetpack Compose
Jorge Castillo writes about Jake Wharton’s Mosaic
library for implementing a console/terminal UI using Compose. Jorge dives
into the Mosaic implementation to explain how it works, from its node structure
to its custom Applier
to its approach for managing recompositions.
Other Interesting Links
- When Compose remember cannot forget
- Medium: Jetpack Compose Interaction and Indication
- How to use Custom Fonts with Jetpack Compose
- Medium: Sunsetting compose-router
- Slides: Building a navigation framework in Compose
- Creating custom shapes with paths in jetpack compose
- Quick Bites: What should you care about Recomposition?
- Medium: Customize Layout Using Measured Policy
- Medium: Bottom Navigation in Compose Way
- Medium: Snackbars in Jetpack Compose
- Jetpack Compose Navigation Drawer Example
- The compose symphony: A beginners guide to Jetpack Compose
- Medium: Creating Simple TODO App Using Jetpack Compose MVVM
- Text Clock in Android using Jetpack Compose
- Medium: Jetpack Compose vs XML for a job in 2022
Resource Roundup
100% pure code!
GitHub: SmartToolFactory / Compose-BeforeAfter
The SmartToolFactory team continues churning out composables! This time, they released a library with composables that show two images (or other composables) side by side, with a slider between them to illustrate the changes between those two images/composables. Honestly, the video in the GitHub README will explain this way better than I will…
GitHub: ndungujan23 / Country-Picker-Jetpack-Compose-
GitHub user ndungujan23 brings us GCountryField()
and GCountryDialCodeDropdown()
composables for allowing users to select countries and/or dialing codes for those
countries.
…And One More Thing
The Compose 1.2.0 release comes just about a year after the initial stable 1.0.0 release. That is a fairly nice update pace: frequent enough to allow for steady improvement, but not so frequent that everyone is constantly trying to catch up. In particular, for library authors, a semi-annual release to adopt the latest Compose dependencies seems reasonable.
Overall, it feels like we are in the beginning steps of the “early majority” phase of the “technology adoption life cycle” with Compose. Compose is widespread, but it is not yet dominant. Contrast that with Kotlin for Android development, where it feels like we are squarely in the “late majority” phase. Kotlin is about four years ahead of Compose, as it was at 2017’s edition of Google I|O where official Kotlin support was announced. It will be interesting to see where we are with Compose adoption in 2026.
Fortunately, with these technologies well underway, we can focus our innovation efforts on other stuff. For example, we have only 40 years to invent flying cars that can fold into a briefcase.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-12-10: A Compose Multiplatform alpha! Hot reload! Presentation! Sprites! Calendars!
- 2024-12-03: Rebecca Franks on clipping and masking! Stefano Natali on graphicsLayer()! FunkyMuse on type-safe nav results! And... if we have enough maps, do we need to store our maps in a Map?!?
- 2024-11-26: Math! Shared element transitions! Custom modifiers! Macrobenchmark! Adapting to platform-specific design systems! And... why does wrapContentSize() not wrap my content size?!?