BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Jetpack Compose 1.1 Improves Performance and Visual Consistency

Jetpack Compose 1.1 Improves Performance and Visual Consistency

This item in japanese

The recent 1.1 release of Android's declarative UI toolkit Jetpack Compose improves accessibility of all touch targets, adds an image vector cache to improve performance, and stabilizes a few experimental APIs.

The new ImageVector cache will significantly improve performance, says Google. In particular, the cache will include all vector images created using the painterResource API, which is a commodity API that is used to load vector drawables as well as rasterized assets without requiring the user to know in advance their types.

Jetpack Compose 1.1 also moves in the direction of enforcing accessibility requirements for touch targets, such as buttons and other controls. For example, Android Material accessibility guidelines require that a radio button be at least 48x48dp. This means, Jetpack Compose may add extra space around the component to ensure it is not placed too close to the edge of a layout or near to another component. Besides ensuring minimum usability requirements to be met, this change will also improve visual consistency by making sure Compose follows the same defaults that are applied for Material Design Components, e.g., in Views.

It is worth noting that the new touch target sizing behavior can potentially alter existing UI layouts, thus possibly breaking them. For this reason, the new behavior can be disabled by setting the LocalMinimumTouchTargetEnforcement property to false, although in that case your UI will not meet minimum usability requirements.

In Jetpack 1.1, a number of animation related APIs have become stable. For example, the AnimatedVisibility composable used to animate the appearance and disappearance of some content by applying enter and exit transitions. Stabilized exit and enter transitions include fade in and out, scale in and out, slide in and out, etc.

Additionally, a few new APIs have been introduced experimentally. For example, rememberSaveable can now be used with AnimatedContent, while the new BringIntoView API can be used so a parent will scroll to bring an item into view.

To get the full details about each of the seven components that make up Jetpack Compose, do not miss the official release notes.

About the Author

Rate this Article

Adoption
Style

BT