Jetpack Compose 1.11 brings updates for testing, debugging, and styling
The UI toolkit for Android changes how coroutines are handled, revises trackpad support, and brings new possibilities for visual debugging.
(Image: quietbits / Shutterstock.com)
Google has updated its Android UI toolkit Jetpack Compose with the April release. Version 1.11 brings innovations for visual debugging, trackpad support, and coroutines, among other things, and introduces some experimental APIs.
Updates for coroutines and visual debugging
A new behavior is now applied by default for dispatching coroutines in tests, which has been available as an opt-in since version 1.10: Jetpack Compose 1.11 uses a new API that uses StandardTestDispatcher instead of UnconfinedTestDispatcher, allowing tasks to be queued instead of executed immediately. This is intended to align test behavior with production behavior.
Furthermore, new tooling is available for visual debugging of shared elements and Modifier.animatedBounds. This should make it easier for developers to determine if a transition looks different than expected. To achieve this, they surround SharedTransitionLayout with the Composable LookaheadAnimationVisualDebugging.
Videos by heise
Revised trackpad support
Jetpack Compose now handles trackpad events differently, affecting integrated notebooks, external trackpads used with tablets, and virtual trackpads, among others. These events are now treated as PointerType.Mouse events, so mouse and trackpad behavior better aligns with user expectations. Previously, trackpad events were handled differently from mouse events, leading to trackpad clicks and drags causing scrolling instead of selection.
Experimental APIs for styling and more
Some experimental APIs are also included in the new release. The new Style API is intended to enable deeper and simplified user customization of visual elements of components and bring performance improvements. The mediaQuery API, meanwhile, is intended to provide a declarative and performant way to adapt a user interface to its environment while minimizing boilerplate code. The experimental Grid API is available for two-dimensional, complex layouts.
More information about the April release of Jetpack Compose is available on Google's Android Developers Blog.
(mai)