Google releases Jetpack Compose beta, with a stable API, accessibility support, and more
Here we are again. I wrote about Jetpack Compose, Google’s new UI engine, back when it went into alpha, and again when JetBrains ported it to desktop platforms. Today, the beta release of Jetpack Compose is here.
In case you aren’t caught up on all the new UI technologies in existence (I don’t blame you) and you don’t want to read through those other articles (now I do blame you), here’s a quick description of what this is all about. Jetpack Compose is a declarative UI engine written in Kotlin that aims to replace (or at least be a viable alternative for) classic imperative UI engines, like Android’s XML layouts. I won’t get into the difference between declarative and imperative layouts, so let’s just say Jetpack Compose is a powerful code-only layout engine that can make UI implementation a lot easier.
With that out of the way, what does a beta release for Compose mean, exactly? Well, let’s see.
API
Every good framework needs an API (by definition). In the pre-alpha and alpha stages, Google was hard at work building up Compose’s API to be as intuitive and useful as possible. And just like every good project, it went through a lot of revisions. Using Compose in these stages could be difficult since APIs could be removed or renamed without much warning.
Now that we’re at the beta stage, Google is confident that the API is complete and stable. That means no more (drastic) removals or changes, so you can spend more time actually making your app than keeping up with API changes.
Of course, a stable API doesn’t mean an immutable one. Google will still add features and change stuff around, but now there will be proper deprecation notices and replacement cycles.
Coroutine Support
Remember when Google deprecated the AsyncTask in Android, and everyone was worried and then forgot about it altogether? You can probably thank Kotlin’s coroutine framework for that. In its most basic form, it’s a replacement for AsyncTask, but it’s also much more powerful, much more flexible, and much more cross-platform.
While Jetpack Compose has sort of supported the use of coroutines, it’s mostly been as an interoperability layer. With the beta, though, coroutines are built into Compose, so you can properly use your async calls again.
Animations
Animations can be kind of annoying to build in Android, and for a while, they were in Compose, too. In the beta, however, Google promises an “easy to use” animations API to make things easier. They’ve also updated Android Studio to include support for previewing these animations, so you don’t have to deploy your app to test them.
Layouts
Android Studio has some pretty neat tools for dealing with layouts. One is the layout preview, which lets you see approximately what your layout will look like on a device, and the other is the layout inspector, which lets you see exactly what’s going on with your app’s layout when it’s on a device.
Before now, the layout preview did work with Compose layouts, but you had to rebuild your app every time you changed something for the preview to update. Now that we’re in beta, though, Android Studio has been updated to include live previews of your Compose code.
Also before now, the layout inspector essentially didn’t function with Compose layouts. It would show a screenshot of the app, but it wasn’t able to actually extract and show a wireframe of all the layout components. Just like with the layout preview, Android Studio has been updated with a new layout inspector that supports Compose layouts.
Talkback
Now let’s talk accessibility, an incredibly important feature that is unfortunately usually forgotten. Luckily, Google didn’t forget, although it could have come sooner: Compose layouts now support Talkback, an advanced screen reader on Android that both reads content to you and lets you interact with the display using simple gestures.
While this is the only major accessibility feature for now, Google has promised that, by stable, other accessibility features will be added. Better late than never, I guess, and hopefully these features will be more tightly integrated with Compose than they were with XML.
And that’s pretty much everything.
If you want to get started with Jetpack Compose, now’s a pretty good time. You’ve got a feature-complete API to play around with and learn, and plenty of tutorials straight from Google. Check out Google’s Developer Website for more information on updates and how to use Compose.
And, of course, tell us what you think about the changes in beta or your opinion on Compose in general.
The post Google releases Jetpack Compose beta, with a stable API, accessibility support, and more appeared first on xda-developers.
from xda-developers https://ift.tt/3dFcUkw
via IFTTT
Aucun commentaire: