Mobile

time to construct wearable apps with Compose!

Written by admin



Posted by Kseniia Shumelchyk, Android Developer Relations Engineer

Immediately we’re launching model 1.0 of Compose for Put on OS, the primary secure launch of our fashionable declarative UI toolkit designed to assist builders create lovely, responsive apps for Google’s smartwatch platform.

Compose for Put on OS was constructed from the underside up in Kotlin with assumptions of recent app structure. It makes constructing apps for Put on OS simpler, quicker, and extra intuitive by following the declarative method and providing highly effective Kotlin syntax.

The toolkit not solely simplifies UI improvement, but in addition gives a wealthy set of UI elements optimized for the watch expertise with built-in assist of Materials design for Put on OS, and it’s accompanied by many highly effective instruments in Android Studio to streamline UI iteration.

What this implies

The Compose for Put on OS 1.0 launch signifies that the API is secure and has what you want to construct production-ready apps. Shifting ahead, Compose for Put on OS is our really useful method for constructing consumer interfaces for Put on OS apps.

Your suggestions has helped form the event of Compose for Put on OS; our developer neighborhood has been with us every step of the best way, participating with us on Slack and offering suggestions on the APIs, elements, and tooling. As we’re engaged on bringing new options to future variations of Compose for Put on OS, we’ll proceed to welcome developer suggestions and options.

We’re additionally excited to share how builders have already adopted Compose of their Put on OS apps and what they like about it.

What builders are saying

Todoist helps folks manage, plan and collaborate on tasks. They’re one of many first corporations to utterly rebuild their Put on OS app utilizing Compose and redesign all screens and interactions:

“When the brand new Put on design language and Compose for Put on OS have been introduced, we have been thrilled. It gave us new motivation and alternative to speculate into the platform.

Todoist utility

Counting on Compose for Put on OS has improved each developer and consumer expertise for Todoist:

“Compose for Put on OS helped us tremendously each on the event facet and the design facet. The guides and documentation made it straightforward for our product designers to organize mockups matching the brand new design language of the platform. And the libraries made it very straightforward for us to implement these, offering all the mandatory widgets and customizations. Swipe to dismiss, TimeText, ScalingLazyList have been all elements that labored very nicely out-of-the-box for us, whereas nonetheless permitting us to make a recognizable and distinct app.”

Outdooractive helps folks plan routes for mountain climbing, biking, working, and different out of doors adventures. As wearables are a key side of their product technique, they’ve been fast to replace their providing with an app for the consumer’s wrist.

Outdooractive utility

Outdooractive has already embraced Put on OS 3, and by migrating to Compose for Put on OS they aimed for developer-side advantages similar to having a contemporary code base and elevated improvement productiveness:

Large enchancment is how lists are created. Because of ScalingLazyColumn it’s simpler (in comparison with RecyclerView) to create scrolling screens with out losing sources. Availability of ordinary elements like Chip helps saving time by having the ability to use pre-fabricated design-/view-components. What would have taken us days now takes us hours.

The Outdooractive crew additionally highlighted that Compose for Put on OS utilization assist them to try for higher app high quality:

Improved animations have been a pleasant shock, permitting easily hiding/revealing elements by simply wrapping elements in “AnimatedVisibility” for instance, which we utilized in locations the place we’d usually not have invested any time in implementing animations.


One other developer we’ve been working with, Interval Tracker helps maintain observe of interval cycles, ovulation, and the possibility of conception.

     
Interval Tracker utility

They’ve taken benefit of our UI toolkit to considerably enhance consumer interface and rapidly develop new options obtainable solely on Put on OS:

“Compose for Put on OS offered us with many kits to assist us deliver our designs to life. For instance, we used Chips to design the primary buttons for interval recording, water ingesting, and taking medicine, and it additionally helped us create a singular search for the most recent model of Kegel exercise.

Equally to different builders, Interval Tracker famous that Compose for Put on OS helped them to attain higher developer expertise and improved collaboration with design and improvement groups:

“For instance, earlier than Chips elements have been obtainable, we had to make use of a customized technique to load pictures on buttons which brought about numerous adaptation work. Sure, Compose for Put on OS improved our productiveness and made our designers extra keen to design a greater consumer expertise on wearables.

Try the in-depth case research to be taught extra about how different builders are utilizing Jetpack Compose.

1.0 launch

Let’s look into the important thing options obtainable with 1.0 launch:

  • Materials: The Compose Materials catalog for Put on OS already affords extra elements than can be found with View-based layouts. The elements observe materials styling and likewise implement materials theming, which lets you customise the design on your model.
  • Declarative: Compose for Put on OS leverages Trendy Android Growth and works seamlessly with different Jetpack libraries. Compose-based UIs most often end in much less code and speed up the event course of as a complete, learn extra.
  • Interoperable: When you have an present Put on OS app with a big View-based codebase, it is doable to regularly undertake Compose for Put on OS through the use of the Compose Interoperability APIs slightly than having to rewrite the entire codebase.
  • Handles completely different watch shapes: Compose for Put on OS extends the muse of Compose, including a DSL for all curved components to make it straightforward to develop for all Put on OS machine shapes: spherical, sq., or rectangular with minimal code.
  • Efficiency: Every Compose for Put on OS library ships with its personal baseline profiles which can be routinely merged and distributed along with your app’s APK and are compiled forward of time on machine. Typically, this achieves app efficiency for manufacturing builds that’s on-par with View-based apps. Nonetheless, it’s essential to know easy methods to configure, develop, and take a look at your app’s efficiency for one of the best outcomes. Study extra.

Be aware that utilizing model 1.0 of Compose for Put on OS requires utilizing the model 1.2 of androidx.compose libraries and due to this fact Kotlin 1.7.0. Learn extra about Jetpack Compose 1.2 launch right here.

Instruments and libraries

Android Studio

The declarative paradigm shift additionally alters the event workflow. The Compose tooling obtainable in Android Studio will enable you construct apps extra productively.

Android Studio Dolphin features a new mission template with Compose for Put on OS that can assist you get began.

The Composable Preview annotation permits you to immediately confirm how your app’s format behaves on completely different watch sizes and styles. You possibly can configure the machine preview to indicate completely different Put on OS machine varieties (spherical, rectangle, and so on):

import androidx.compose.ui.tooling.preview


@Preview(

    machine = Gadgets.WEAR_OS_LARGE_ROUND,

    showSystemUi = true,

    backgroundColor = 0xff000000,

    showBackground = true

)

@Composable

enjoyable PreviewCustomComposable() {

    CustomComposable(…)

}

Beginning with Android Studio Electrical Eel, Reside Edit helps iterative code improvement for Put on OS, offering fast suggestions as you make modifications within the editor and instantly reflecting UI within the Preview or working app on the machine.

Horologist

Horologist is a gaggle of open-source libraries from Google that complement Put on OS improvement, which we introduced with the beta launch of Compose for Put on OS. Horologist has graduated numerous experimental APIs to secure together with TimeText fadeAway modifiers, WearNavScaffold, the Date and Time pickers.

      

Date and Time pickers from Horologist library     

Studying Compose

In case you are unfamiliar with utilizing Jetpack Compose, we advocate beginning with the tutorial. Lots of the improvement ideas there additionally apply to Compose for Put on OS.

To be taught extra about Compose for Put on OS try:

Now that Compose for Put on OS has reached its first secure launch, it’s time to create lovely apps constructed for the wrist with Compose!

Be a part of the neighborhood

Be a part of the dialogue within the Kotlin Slack #compose-wear channel to attach with the crew and different builders and share what you’re constructing.

Present suggestions

Please maintain offering us suggestions on the concern tracker and tell us your expertise!

For extra details about constructing apps for Put on OS, try the developer web site.



About the author

admin

Leave a Comment