Android Wear: New complications tools and watch friendly UI library

Posted by Hoi Lam, Lead Developer Advocate, Android Wear


Android Wear 2.0 gives users more informative watch faces and provides developers with new ways to build useful apps. These new opportunities have been well received by users and developers alike. To help developers take advantage of these new features, we have released a suite of complication API tools, to make it easier for developers to add complication support to their watch faces, and a new Wear UI library, to help developers build watch friendly user interfaces.


New Complications API tools for Watch Face developers



Complications are bite-sized pieces of information displayed directly on the watch face. They can also be great shortcuts into your favorite apps. We introduced the Complications API last year to enable watch faces to receive data from any app that the user selects, and display the data to the user in a way that is stylistically coherent. Today, we are introducing four new tools to make it easier for watch face developers to integrate with the Complications API:



  • TextRenderer - Auto-sizes text to fit in bounds defined by watch face makers.

  • ComplicationDrawable - A full rendering solution for complications, that handles all the styling for you, and adjusts the layout to fit the space you specify

  • Easy watch face settings sample - Adoptable sample code that makes it easier to build complication settings with a rich and usable experience.

  • Complication test suite - A sample data provider to help check that your watch face can handle all the combinations of fields that can make up complication data.



It's never been easier to integrate complications into your watch faces.


New Wear UI Library for Wear developers



We have provided Android view components for building watch friendly user interfaces since the launch of Android Wear 1.0. Developers have told us that they would like to see these components open sourced. So, starting at Google I/O, we are open sourcing some components and providing some Android Wear UI components in the Android Support Library. This brings a number of advantages, including more consistent APIs with the rest of the Support Library, more frequent releases, and better responsiveness to developer feedback. We will:


  • Migrate Wearable Support classes - Migrate and update Android Wear specific view components, such as WearableRecyclerView, from android.support.wearable.view in Wearable Support to android.support.wear.widget in the Android Support Library. This new package is available as open source. In terms of developer impact, we expect the migration process to be simple, with minor API name changes to bring consistency with the existing Android Support Library.

  • Merge some Android Wear functionality to Android - Some Android Wear components have a lot of overlap with Android, e.g. CircledImageView and DelayedConfirmationView. We will merge the Android Wear specific functionality with the Android counterparts under android.support.v4.widget.

  • Deprecate outdated user interface patterns - Two user interface patterns are deprecated with Android Wear 2.0: the Card pattern and the Multi-directional layout. As a result, we have deprecated all supporting classes, such as GridViewPager and CardFragment. Please refer to the class reference docs for their replacements.



In the first wave of these changes, we migrated the WearableRecyclerView, BoxInsetLayout and SwipeDismissFrameLayout classes to the new Android Wear UI Library. We expect the migration process to continue during 2017, and developers will have until mid-2018 to migrate to the new UI components. For additional information, see Using the Wear UI Library.



Get started and give us feedback!



To get started with these new tools, simply update the Android Support Library in Android Studio and update your gradle build files to import the new support libraries. In addition to the documentation links above, check out the Google I/O session - Android Wear UI development best practice - where lead engineers for these tools will be on-hand to explain the technical details.



We will continue to update these tools over the next few months, based on your feedback. The sooner we hear from you, the more we can include, so don't be shy! Let us do some of the heavy lifting for your Android Wear apps and watch faces.


Komentar

Postingan populer dari blog ini

Google Play Referrer API: Track and measure your app installs easily and securely

Boosting developer success on Google Play

And the 2019 Google Play Award nominees are...