• 由两个应用程序组成，一个是用于智能手机的移动应用程序，另一个是用于 Android Wear 兼容设备（例如智能手表）的可穿戴应用程序 它是用 Google Nexus 5 智能手机和 Moto 360 手表开发和测试的，但应该与任何运行 ...
• wear手表软件合集Android Wear is a rather useful addition to your arsenal of technology, but getting to know a completely new device can be overwhelming. Here’s everything you need to know about ...


wear手表软件合集

Android Wear is a rather useful addition to your arsenal of technology, but getting to know a completely new device can be overwhelming. Here’s everything you need to know about setting up, tweaking, and using your new Android Wear watch.
Android Wear是对您的技术库的一个非常有用的补充，但是要了解一个全新的设备可能会让人不知所措。 您需要了解所有有关设置，调整和使用新的Android Wear手表的信息。
NOTE: These instructions assume you’re using the latest version of Android Wear, 2.0. If your watch is still on Android Wear 1.5 and hasn’t updated, we’ve made notes on any differences you’ll encounter. In addition, if you’re using Android Wear with an iPhone, you’ll want to read our guide to iOS and Android Wear in addition to this one.
注意：这些说明假定您使用的是最新版本的Android Wear 2.0。 如果您的手表仍在Android Wear 1.5上且尚未更新，则我们会记录您可能遇到的任何差异。 此外，如果您将Android Wear与iPhone配合使用，则除此指南外 ，还需要阅读有关iOS和Android Wear的指南 。
When you first turn on your watch, you’ll be greeted with the welcome screen. Swipe to the left to choose your language and continue, swiping through the instructions until you see a code.
首次打开手表时，会出现欢迎屏幕。 向左滑动以选择您的语言并继续，在说明中滑动，直到看到代码。
On your phone, make sure Bluetooth is turned on, and download the Android Wear app from the Google Play Store and start it up. You should see the same code that appears on your watch face, as shown below. Tap it to pair your watch with your phone.

You will see a popup on your phone asking to pair. Check the box to allow your watch to access your contacts and call history and tap Pair.
您会在手机上看到一个弹出窗口，要求配对。 选中该框以允许手表访问您的联系人和通话记录，然后点按“配对”。

Once paired, your watch may update its software, after which it will scan your phone for Android Wear-compatible apps and sync them.
配对后，您的手表可能会更新其软件，然后它将扫描您的手机以查找与Android Wear兼容的应用并进行同步。
While it does that, you may see a new notification on your phone to add your watch as a “trusted device” for Android’s Smart Lock feature. This allows you to unlock your phone without a PIN as long as it’s connected to your watch–which is very convenient. I recommend turning this on, so tap the notification and tap “Add a Trusted Device”.
这样做时，您可能会在手机上看到一条新通知，将手表添加为Android的Smart Lock功能的“受信任设备”。 只要您将手机连接到手表，就可以在没有PIN的情况下解锁手机-这非常方便。 我建议将其打开，因此点击通知，然后点击“添加受信任的设备”。

Your watch is now paired with your phone. It will take you through a brief tutorial, after which you’ll land on the default watch face, ready to start using it.
您的手表现在已与手机配对。 它会带您完成一个简短的教程，之后您将进入默认表盘，开始使用它。
如何更换表盘 (How to Change Your Watch Face)
Okay, let’s be honest–you’d like to learn how to use your watch, but before that, you’ll probably want to change the watch face. Don’t worry, it was the first thing we did too. To change your watch face, swipe your finger left or right. (If you’re still on Android Wear 1.5, press and hold on the watch face instead.) A sliding menu will pop up with all your watch face options. You can swipe left and right to see them all, and tap on a watch face to enable it.
好的，说实话–您想学习如何使用手表，但是在此之前，您可能需要更换表盘。 别担心，这也是我们要做的第一件事。 要更改表盘面，请向左或向右滑动手指。 (如果您仍在使用Android Wear 1.5，请按住表盘。)将弹出一个带有所有表盘选项的滑动菜单。 您可以左右滑动以查看全部内容，然后点击表盘将其启用。

Some watch faces may have extra settings, denoted by the gear icon under them. Tap the gear icon to access those extra settings. This could include anything from colors and styles to which information your watch face shows. For example, if you aren’t interested in how many steps you’ve taken, you can change that part of the watch face to show your next alarm instead.
某些表盘可能具有额外的设置，由其下方的齿轮图标表示。 点按齿轮图标可访问这些额外设置。 这可能包括从颜色和样式到表盘所显示信息的任何内容。 例如，如果您对已执行的步骤不感兴趣，则可以更改表盘的该部分以显示下一个警报。

Swipe from the left screen edge to exit and go back to your watch face.
从屏幕左边缘滑动以退出并返回表盘。
You can also download new watch faces, but we’ll discuss that later in the guide. For now, it’s time to learn the basics.
您也可以下载新的表盘，但稍后将在指南中进行讨论。 现在，是时候学习基础知识了。
Android Wear的基本滑动和手势 (The Basic Swipes and Gestures of Android Wear)
To navigate Android Wear, you’ll use a series of swipes and taps.
要浏览Android Wear，您需要使用一系列的滑动和点击。
First, let’s talk about the watch face. Your watch actually has two “faces”. When you’re using the watch, you’ll see the full watch face, often including info like battery, weather, and the date. However, after a few seconds of inaction, the watch screen will go into “Ambient Mode”, dimming the screen and showing a more minimalist version of the face, without all the extra color and info. This helps save your watch’s battery, only showing you the info you need when you really need it.
首先，让我们谈谈表盘。 您的手表实际上有两个“面Kong”。 使用手表时，您会看到整个表盘，通常包括电池，天气和日期等信息。 但是，几秒钟不进行操作后，手表屏幕将进入“环境模式”，使屏幕变暗并显示更简约的脸部版本，而没有所有其他颜色和信息。 这有助于节省手表的电池电量，仅在真正需要时才显示所需信息。

When the watch is dimmed, Tap the screen (you may have to hold for half a second or so) to see the full version of your watch face. Some watches will also switch to the full watch face automatically when you turn your wrist to look at the watch, though in our experience with the Fossil Q Founder this was a little hit or miss.
手表变暗时，点按屏幕 (您可能需要按住半秒钟左右)以查看完整的表盘。 当您转动手腕看手表时，某些手表也会自动切换到完整的表盘，尽管根据我们使用Fossil Q Founder的经验，这可能会有些失误。
You can then wait a few seconds for the watch to re-dim, or press the face of the watch with your palm to dim the screen right away.
然后，您可以等待几秒钟以使手表重新变暗，或者用手掌按一下手表的表面以立即使屏幕变暗。
Swipe up from the bottom edge of the main watch face to view your notifications (if you have any). We’ll discuss more about notifications in the next section.
从主表面的底部边缘向上滑动以查看通知(如果有的话)。 我们将在下一节中讨论有关通知的更多信息。

Swipe down from the top edge for the quick settings screen, which includes Airplane Mode, Do Not Disturb, Settings, and “Theater Mode”, which turns off the screen and notifications until you press the side button. (On Android Wear 1.5, you’ll have to swipe right and left to see some of these options.)
从顶部边缘向下滑动以进入快速设置屏幕，其中包括飞行模式，请勿打扰，设置和“剧院模式”，这将关闭屏幕和通知，直到您按下侧面按钮。 (在Android Wear 1.5上，您必须左右滑动才能看到其中一些选项。)

Press the button on the crown (or, on Android Wear 1.5, swipe in from the right edge) to access all your apps. You’ll see your recently used apps at the top, with a full list below it. (We’ll talk about apps later in this article). Android 1.5 users can can swipe right again to see your contacts list, and a third time to get to Google’s voice actions.
按下表冠上的按钮 (或在Android Wear 1.5上，从右边缘向内轻扫)以访问所有应用程序。 您会在顶部看到您最近使用过的应用，并在其下方找到完整列表。 (我们将在本文后面讨论应用程序)。 Android 1.5用户可以再次向右轻扫以查看您的联系人列表，第三次可以获取Google的语音操作。

When you receive a notification, your watch will vibrate and a popup will appear showing a preview of the message or alert. You can tap on it to read the full message, or tap the shortcut at the bottom to perform a quick action (in this case, archiving the email). To dismiss a notification, swipe it left or right.
收到通知时，手表将振动，并出现一个弹出窗口，显示消息或警报的预览。 您可以点击它以阅读完整的消息，或者点击底部的快捷方式以执行快速操作(在这种情况下，将电子邮件存档)。 要关闭通知，请向左或向右滑动。

If you tap on it to read the full message, you can then swipe up from the bottom edge for more actions.
如果点击它以阅读完整的消息，则可以从底部边缘向上滑动以执行更多操作。

If you choose to reply to the message, you’ll get a few options: you can dictate a message with your voice, draw an emoji, or choose from one of Google’s many pre-written responses, like “Yes” or “On my way”. You can even use the watch-sized keyboard, which isn’t as bad as it seems (especially if you swipe with your finger rather than tap on each key).

If you have multiple notifications, you can scroll through them by swiping up. If you have “Wirst Gestures” enabled in Settings > Gestures, you can also flick your wrist toward you or away from you to scroll through them.
如果您有多个通知，则可以向上滑动以滚动浏览它们。 如果在“设置”>“手势”中启用了““ Wirst Gestures””，则还可以将手腕向自己的方向或向远离自己的方向滑动，以滚动浏览它们。

You can also “pivot” your arm up and down to select cards or go back. Essentially, this gesture acts the same as tapping/swiping to the right, and swiping to the left, respectively.
您也可以上下“旋转”手臂以选择卡片或返回。 本质上，此手势的作用与分别向右轻击/滑动和向左轻扫相同。

Lastly, you can shake your wrist back and forth to exist whatever screen you’re on and return to the watch face.
最后，您可以来回摇动手腕以在任何屏幕上都存在，然后返回表盘。
用声音控制一切 (Control Everything With Your Voice)
Like many Android phones, your watch can listen for commands from you. Either press and hold the crown button to bring up Google Assistant, or—if “Ok Google Detection” is turned on in Settings > Personalization, you can say “OK, Google” at any time to bring up Google Assistant. You can say any command out loud, but if you swipe up, Google gives a few examples in a list.

You can say things like:
您可以说以下内容：
There are lots of other things you can do, potentially even using third-party apps…as long as they support Google Assistant. (Android Wear 1.5 was slightly better with this, allowing you to pick default apps for voice commands under “Device Settings” in the Android Wear app on your phone.)
您还可以做很多其他事情，甚至可以使用第三方应用程序……只要它们支持Google Assistant。 (Android Wear 1.5在此方面略胜一筹，可让您在手机上Android Wear应用的“设备设置”下为语音命令选择默认应用。)
安装新的应用程序和表盘 (Install New Apps and Watch Faces)
Android Wear 1.5 just synced watch-friendly interfaces for the apps on your phone, but Android Wear 2.0 has its own Google Play Store complete with standalone watch apps. Slide over to see the apps on your watch, scroll down to Play Store, and search for the apps you want. Some apps have Wear-compatible counterparts, some don’t. If you scroll down on the main Play Store page, you can see which of your installed phone apps have Wear counterparts and install them right there, which is nice.
Android Wear 1.5只是同步了手机上适用于观看的界面，但Android Wear 2.0拥有自己的Google Play商店，其中包含独立的观看应用程序。 滑过以查看手表上的应用程序，向下滚动到Play商店，然后搜索所需的应用程序。 有些应用具有与Wear兼容的应用，有些则没有。 如果您在Play商店的主要页面上向下滚动，则可以看到哪些已安装的手机应用具有Wear对应功能，然后将其安装在该位置即可。
NOTE: Android Wear apps take a while to install, at least in our testing, so give them some time.
注意：至少在我们的测试中，Android Wear应用需要花一些时间安装，因此请花一些时间。

Alternatively, you can browse the Android Wear section of Google Play in your browser. There’s no way to search just Android Wear apps from the desktop (only your phone), but you can search for things like “watch face” to try and drill down in certain categories.
另外，您也可以在浏览器中浏览Google Play的Android Wear部分 。 无法从桌面(仅您的手机)上仅搜索Android Wear应用，但是您可以搜索“表盘”之类的内容来尝试对某些类别进行深入研究。

To use an app, just swipe from the right edge of the screen and tap on an app’s icon. Many will take advantage of your watch’s features in a way that’s even more convenient than their phone counterparts. For example, if you bring up a Google Keep note on your watch, it will stay on the screen, even if the watch dims. This is great if, for example, you’re using it as a grocery list–no more needing to constantly unlock your phone to check your list. Just glance at your watch.
要使用应用程序，只需从屏幕的右边缘滑动，然后点击应用程序的图标。 许多人将以比手机更方便的方式利用手表的功能。 例如，如果您在手表上调出一个Google Keep记事，即使手表变暗，它也会保留在屏幕上。 例如，如果您将其用作购物清单，则非常好-无需再不断解锁手机来检查清单。 看看您的手表。
调整您的Android Watch设置 (Tweak Your Android Watch’s Settings)
Your Android watch has quite a few options that let you customize your experience. To open the settings on your watch, swipe left to open the app drawer, and tap the Settings icon. (Alternatively, swipe down from the top and tap the Settings button.)
您的Android手表有很多选项，可让您自定义体验。 要打开手表上的设置，请向左滑动以打开应用程序抽屉，然后点击“设置”图标。 (或者，从顶部向下滑动，然后点击“设置”按钮。)
From the Settings app, you can adjust the brightness, change the font size, or turn certain features (like always-on screen or wrist gestures) on or off. At the bottom, under “System”, you can shut down or restart your watch when you aren’t using it.
在“设置”应用中，您可以调整亮度，更改字体大小或打开或关闭某些功能(例如始终显示屏幕或手腕手势)。 不用时，您可以在底部的“系统”下关闭或重新启动手表。

Under Connectivity, you can connect your watch to a Wi-Fi network in the settings, which will allow your watch to stay connected to your phone even if it’s out of Bluetooth’s short range. That way, you can leave your phone on the other end of the house, but still access all your apps from your watch.
在“连接性”下，您可以在设置中将手表连接到Wi-Fi网络，即使手表不在蓝牙的短距离范围内，也可以使手表保持与手机的连接。 这样，您可以将手机放在房子的另一端，但仍可以从手表访问所有应用程序。

Lastly, if you head to Settings > Apps, each app has a useful “Permissions” option that lets you decide what that app has access to. For example, I don’t use Google Fit, so I can block it from tracking my location and using sensors to count my steps. Some have reported this helps save battery.

You can tweak other watch settings on your phone. Open the Android Wear app and click the settings icon in the upper right-hand corner. You can adjust which calendars show up on your watch, block or unblock apps from sending notifications to your watch, mute alerts and calls on your phone whenever it’s connected to your watch, and more.
您可以在手机上调整其他手表设置。 打开Android Wear应用，然后点击右上角的设置图标。 您可以调整手表上显示的日历，阻止或取消阻止应用程序向手表发送通知，将手机连接到手表时使手机静音和拨打电话等。

At the top of the settings screen, under “Device settings”, tap on your watch’s name (in my case, “Q Founder”) to see device-specific options. You can turn off the always-on screen, tilt gesture, or unpair the watch from your phone. You can also see information about your watch’s battery and storage.
在设置屏幕顶部的“设备设置”下，点击手表名称(在我的情况下为“ Q Founder”)以查看特定于设备的选项。 您可以关闭常亮屏幕，倾斜手势或将手表与手机取消配对。 您还可以查看有关手表电池和存储的信息。

Android Wear can seem a little confusing and overwhelming at first, even for tech-savvy folks. After all, it’s an entirely new kind of device most of us have never used before. But once you get the hang of the basics and tweak the settings to your liking, it’s actually a very simple–not to mention useful–addition to your collection of tech tools.
刚开始，Android Wear似乎有些令人困惑和不知所措，即使对于精通技术的人而言。 毕竟，这是我们大多数人从未使用过的全新设备。 但是，一旦掌握了基础知识并根据自己的喜好对设置进行了调整，它实际上就是对您的技术工具集合的一种非常简单(更不用说有用)的添加。

翻译自: https://www.howtogeek.com/241222/how-to-set-up-tweak-and-use-your-android-wear-watch/

wear手表软件合集

展开全文
• 当你想要提供更多的信息又不想要求用户在手持设备上打开你的应用程序，你可以选择在Android Wear设备上为你的通知添加一个多个Page（页面）。附加的页面会立刻显示在主通知卡片的右边。更多关于如何使用和设计多页面...

----------------------------------------------------------------------------------------------------------------------------------------------------------
译文作者：Jianan - qinxiandiqi@foxmail.com
版本信息：本文基于2014-06-24版本翻译
译文版权：CC BY-NC-ND 4.0，允许复制转载，但必须保留译文作者署名及译文链接，不得演绎和用于商业用途
----------------------------------------------------------------------------------------------------------------------------------------------------------

当你想要提供更多的信息又不想要求用户在手持设备上打开你的应用程序，你可以选择在Android Wear设备上为你的通知添加一个多个Page（页面）。附加的页面会立刻显示在主通知卡片的右边。更多关于如何使用和设计多页面的内容，请参考Design Principles of Android Wear。

例如，下面的代码添加为通知添加了第二个页面：

// Create builder for the main notification
.setSmallIcon(R.drawable.new_message)
.setContentTitle("Page 1")
.setContentText("Short message")
.setContentIntent(viewPendingIntent);

// Create a big text style for the second page
secondPageStyle.setBigContentTitle("Page 2")
.bigText("A lot of text...");

.setStyle(secondPageStyle)
.build();

.build();


展开全文
• Youtube subtitles download by mo.dbxdb.com OLIN LAN: Hello, everybody. I'm Oli Lan, an engineer on the Android Wear team. TONY FERREIRA: And I'm Tony Ferreira, a designer on Android Wear.
Youtube subtitles download by mo.dbxdb.com

OLIN LAN: Hello, everybody.
I'm Oli Lan, an engineer on the Android Wear team.
TONY FERREIRA: And I'm Tony Ferreira,
a designer on Android Wear.
OLIN LAN: It's great to be here.
We're really excited to tell you about the new stuff coming
to watch faces on Android Wear.

The watch face is at the heart of the Android Wear interface.
Of course, it tells the time.
And with the thousands of watch faces on Google Play,
it's a great way for users to express their style.
and the watch face came to life like never before.
But the watch face can do more.
As an always-on screen that's just a glance away,
it's a great place to get the information you care about.
And that's why we're introducing the Complications
API for Android Wear.
TONY FERREIRA: But first of all, what are Complications?
That term comes from traditional watchmaking.
And it means, well, pretty much anything
that's not telling the time.
Complications on mechanical watches
show things like the date, your alarm, or phase of the moon.
So the small dials you see on this watch,
they are complications.
On smartwatches there are new possibilities,
like the weather, stock prices, or events from your calendar.
OLIN LAN: Many watch faces on Android Wear
already include complications, like Bits from usTwo or Legacy
from Zuhanden.
But as it stands, each watch face
has to go and get the data itself.
That could mean your watch face has
to find its own source of weather data,
or finance data, or anything else you want to show.
And if the user wants to see something you haven't included,
they're out of luck.
Or maybe you're not a watch face developer,
but your app has data that would be great on the watch face,
like fitness stats or finance info.
As it stands, there's no way to do this other
than building your own watch face
or making deals with individual watch face developers.

The Complications API for Android Wear
changes all of this.
Apps using the API will be data providers or watch faces.

If you build a watch face using the Complications API,
Here are just some of the partners already working
on using the API.
And if you build a data provider,
you can get your data on a whole range of watch faces.
Now on Google Play, there's a huge range
of styles of watch faces.
So there's no way that just one style,
one visual style of complication would fit on every watch face.
Because of that, with the Complications API,
the watch face gets to decide how to render the data.
It gets to choose the visual style, the colors, the fonts,
etc.
The data provided just provides raw fields
like strings, text, images, and numbers.
Before we get into the details of the API though,
Tony is going to go through some things
to think about when designing for complications.
TONY FERREIRA: Thanks, Oli.
So some of you may have already checked out the Material design
spec for wearables.
And there you'll find a ton of useful things
to help developers and designers design for Android Wear.
I'd like to highlight some of the things, some
of those design principles that you'll find in there
and how they apply to complications.
So the first design principle is glanceable,
making things clear and understandable.
For complications, small, easy to read snippets of information
work best.
It's very important that the information on the watch face
is organized with a clear hierarchy, large enough
to read easily, and high enough in contrast.
Users shouldn't need to squint to read the UI.
The second design principle is time saving,
getting the information you want quickly without any roadblocks.
to find the information you want,
with the introduction of complications,
it's right there on the watch face.
Complications are also tapable.
calendar event.
And complications are also persistent,
there whenever you need them.
The third design principle is consistent.
Complications should have a healthy relationship
with the watch face.
As Oli just said, with Complications on Android Wear,
the watch face decides how the complications are rendered.
So they feel part of the same family.
Consider aligning the style of the complications
with the watch face.
Oli is now going to talk you through the complication types.
OLIN LAN: Thanks, Tony.
So complications are all about data, supplied by provider apps
and displayed on watch faces.
This could include numerical data like your battery level,
text like the title of your next meeting,
or images like an icon or a profile pic.
Not every type of data will fit on every watch face.
There might only be space for a small icon
or a short bit of text.
Or you might want to use numerical data without having
to show text or images.
So watch faces need to say what they can display.
And data providers need to say what they can supply.
To help with this, we've defined a number of complication types.
Complication types determine what kinds of data
are included.
There's usually one field that's the key piece of information.
And we've named the types after that field.
So here you see examples of the short text type.
These are all short text complications.
But as you can see there are optional elements.
There may be an icon or a second string.
But the most important value is contained in the short text
field.
If you're a data provider, you can
choose which of the optional fields to include.
But a short text complication must always
include the short text field.
If you're building a watch face and you support short text,
you need to consider all of these variations.
Here are some other examples.
You might not need any text to convey the information.
Then maybe the icon type is enough.
Or, if you have numerical data within bounds
like a percentage, then the range value type
could be for you.
We also have a few other types.
You'll notice that we have bot icon and small image.
The difference is that images for the icon field
should be tintable by the watch face.
They should be single color with a transparent background.
This allows the watch face to fit it better to its style.
So if you are building a watch face where full color
images won't match the style, then you
can support the icon type.
But you might not want to support the small image type,
where images may be full color.

00:07:41,740 So when you're thinking about the different complication
types, if you are building a provider,
And if you're building complications
into a watch face, think about how many of the types
you want to support.

00:07:58,259 Now back to Tony to talk about some more guidelines for what
face developers.
TONY FERREIRA: OK, so I want to talk a little bit
about the things you should consider
when designing complications.
However, bear in mind there isn't a one size
fits all solution to this.
We have a diverse collection of watch faces on the platform.
And we think it's important that complications
are flexible enough to mirror that diversity.
So please use these guidelines as a starting point.
But if you feel your watch face would benefit
from deviating from these guidelines, then by all means
Complication should never conflict with the surrounding
objects on the watch face.
For more traditional watch face layouts, as shown here,
these red areas, in general, shouldn't have complications.
As it will be a conflict with other parts of the watch face.
Give your complications a bit of space,
so they have room to breathe as well.
And if possible, staying true to the alignment of the watch face
So if you have a center aligned clock,
it might make sense to center align the complications
as well.

00:09:08,190 Complications can be rendered however you wish.
Though you might want to give your data
a little more protection and house them in a container.
So we found these form factors work well
with the various data types.
We have circle, square, pill, and rectangle.
And bear in mind, the size and form of these containers
decide what data types can and can't be rendered.
And containers are optional.
Sometimes they help.
Sometimes they don't.
But the important thing to remember, as a watch face
developer, is you have the freedom to choose.

00:09:51,960 Building a strong relationship with the watch face
is also very important.
to seem like an afterthought.
So here are some things to consider.
Use color to tint the data.
This will help create better harmony with the watch face.
Decide whether your complications need containers
or not.
You can see in this example, in the middle,
we've removed the containers just
to help the complications better integrate into the watch face.

00:10:22,059 And play around with scale.
But most importantly, on top of all that,
just have fun with them.
And don't be scared to get creative.

00:10:36,710 You can have multiple complications on a watch face.
This is awesome for those of us who
want to surface lots of data.
Here you can see we've removed the containers
to create more space.
And we can easily fit eight complications
on a single watch face.
If multiple complications is a direction you wish to go down,
just try to make sure that things don't get too cluttered
and the UI remains glanceable.

00:11:04,009 The Complications API can also be used as a creative tool.
With the ranged value data type, you
can abstract that data whichever way you like.
So in the example, we've shown here,
we display your step count goal.
Throughout the day, as you get closer
to reaching your step count goal,
the graphic in the background also updates.
Presenting the data like this, in
an unconventional and abstract way,
opens the door for more fun and engaging watch faces.

00:11:33,899 And just to finish, here are a few examples
of implemented complications designed
by our creative partners usTwo.
In the first example here, you can
see they've kept things simple and find a straightforward way
of adding complications to a preexisting watch face,
removing containers and tinting the data.

00:11:56,169 The second example is a little more bespoke.
and played around with things like the layout and the form
factors.
This helps better align the complications
with the watch face aesthetic.

00:12:11,370 In the last example, we have had some fun with the range value
data type, creating a really cool generative abstract
design.
In this example, you can imagine your daily step count
or battery level being represented.
I'll now hand you over to Oli, who
is going to talk you through the details of the API.
OLIN LAN: Thanks, Tony.
OK, so let's take a look at how this all fits together.
Android Wear manages the flow of data between data providers
and watch faces.
When data is needed for a complication,
Android Wear will send an update request
to the data provider asking for a specific type of data.
The provider builds a complication data object
and sends it back to Wear.
Android Wear then forwards that onto the watch face,
which can then include it when it renders.
Android Wear also provides the UI
that allows users to choose providers
for each complication.
And we'll talk about that in a bit.
But now let's take a look at what you
need to do to add complications to a watch face.

00:13:25,649 So first of all, you need to decide
how many complications to include
and what types to support in each one.
So, for this example, let's say you
want to include a small round complication on the right.
Now in that space we could support short text.
We could also support icon.
And there's also enough space there to show a ranged value.
Now in that space we could, if we wanted,
support small image as well.
But let's say for this example that we don't want to.
Now let's say we also want to include
a complication at the bottom.
This one could support the same types as the first one.
But there's also enough space to make this one wider.
So it could support the long text type.
Note that we consider this to be the same complication.
Even though it's a different shape, depending on the type.
So to summarizes, these are the types supported
by each of those complications.
One more thing, you need to give each complication
a numerical ID so that you can refer to it with the system.
That's chosen by the watch face.
We call it the watch face complication ID,
and it can be any integer.
OK, so next you need a way for the user
to choose providers for each complication.

00:14:54,590 As I mentioned earlier, Android Wear
provides the UI to choose a provider
for a particular complication.
But the rest of the UI is up to you.
So what we're showing here on the slide
is a basic list that could be part of the watch faces config
activity.
It's the watch face's own settings.
So this screen is not provided by the system.
So when the user taps on item in this list,
the watch face needs to launch that system provider chooser.
Let's look at some code.
So, in order to do that, you use this support library method
to get hold of an intent.
That's createProviderChooserIntent.

00:15:36,880 You pass in the watch face component name.
That's the package and class name of your watch face.
That's just how you refer to your watch face to the system.
And you also pass in the watch face complication
ID for the complication that is being configured.
So that's the number we chose earlier.
You then pass in the types supported by that complication.
In this list, the order doesn't matter.
You list them in order of preference,
with the most preferred coming first.
In this example, we've put ranged value at the top.
That's because that type conveys the most
information to the user.
So that's often a good choice.
OK.
So then when you have the intent,
you call startActivityforResult to show
the system provide chooser.
So, when the user taps on an item in this list,
the system provider choose is shown.
Now when the user chooses a provider in this UI,
it gets setup automatically.
You don't need to do anything else.
OK, so to show the data, what you need to do
is tell the system that your watch
So let's move into the watch face service
itself, specifically the engine.
So what you need to do is call setActiveComplications,
and pass in the watch face complication
IDs for the complications that are ready.
Here we're showing in onCreate of the engine.
That's usually a good place to do it.
But you can call this method from elsewhere.
For example, if the active complications change.

00:17:22,700 Once you've done that, you will start to receive data in calls
to the on complication data update method.

00:17:31,680 The data will come with the watch face complication ID
that it relates to.
Now, you'll only receive data when it changes.
So you'll have to hold onto the complication data object.
And any images, such as icons, should be loaded asynchronously
and be sure to catch them.
Now once you've got the data, it's up to you
how to incorporate it into your watch face.
But before rendering it, you need
to check if the data is still active.
Some complication data is only valid until a certain time.
So for example, it might be for a next event complication.
And then the piece of data will only be relevant
up until the end of that event.
You check it using this method, the
is active method on the complication data.
So you just pass in the current time
when you're drawing a frame to see if you still
need to draw that data.
There's one other thing you should do,
which is to check to see if complications are tapped on.
You do this using the interactive watch face's APIs
that we announced last year.
So that is by implementing onTap command.
If a complication is tapped on, then you
need to check the complication data to see if it specifies
a tap action pending intent.
If there is one, you need to fire that intent when
the computation is tapped on.
This allows deep linking from the complication
straight into a relevant activity.

00:19:03,509 OK, so that's how to add complications
One important tip that goes for watch phase development
in general, but particularly for complications,
is minimize the work you do in every draw call,
especially if you're drawing more than once a second.
Avoid object creation in On Draw wherever possible.
As that can lead to a lot of garbage collection and, hence,
poor performance.
OK, so now let's take a look at how to build a complication
data provider.

00:19:38,599 A data provider is a service.
And to create one, you need to extend complication provider
service from the support library.

00:19:51,154 This class has one abstract method that you must implement.
This method is called whenever the system wants data from you.
So it will be called when a complication using
By which I mean, when the watch face calls
Set Active Complications.
And it will also be called when your provider is
chosen for a complication that's already active.
It can also be called with a certain frequency,
such as every hour, if that's what you want.
And it's also possible to trigger updates
if you need a push style.
For example, if you have a messaging app,
and you want to update a complication when a message
arrives, you could do this.
the provider update request class in the previous support
library.
OK, so let's take a look at an example of how you
might implement this method.
So you'll see that one of the parameters is the type.
That's the complication type that's required.
And the first thing we're going to do is check that.
Now in this example, we're only going to support short text.
In a real world example you would probably
support more than one type.

00:21:11,750 So first thing now is we start building a complication data
object of that type, type short text.
And now we're setting the short text
field, which is the required field for this type.
And we do it assessing it to a simple string, "hello."
You'll notice that it's wrapped here is a complication text
object.
All of the set methods for text in complication data
take one of these complication text objects.
It can just be a wrapper for simple string or char sequence.
It can also be used for other things.
And we'll talk about that a bit later.

00:21:51,390 OK, so we're also going to specify an icon.
That's an optional field for short text.
All of the image set methods for complication data
use the icon class from the Android framework.
That allows it to be either a wrapper
for a resource from your application,
a drawable resource.
Or it could also be a bitmap.
However, as I mentioned earlier, the icon field images
should always be tintable.
They should be single color with a transparent background.
And we strongly recommend you use vector drawables for this.
That's because the watch face could draw the icon
at different sizes.
And using a vector will allow it to resize cleanly.

00:22:37,589 OK, so that completes the complication data
object for this example.
All you need to do next is send that data to the system.
And you do that using the complication manager
object, which is passed in as a parameter
to on complication update.

00:22:56,460 OK, there are two other methods that you can optionally
implement.
They are, onComplicationActivated
onComplicationDeactivate.

00:23:10,880 Complications are activated when the watch face calls Set Active
Complications.
And they are deactivated either by another call
to Set Active Complications with different IDs
or when the user changes watch face.

00:23:25,759 Now, as a service, your provider has
to be declared in the manifest.
And that's also where you use metadata to declare things
like what types you can support and what update period
you would like, if any.
Here, with the supported types, the order does not matter.
And that's because, as I mentioned earlier,
the watch face gets to decide the order of preference
for any particular complication.
Now for the update period, be aware that the update period
is not guaranteed.
We do apply a minimum.
The system applies a minimum.
So you should think in terms of minutes
or longer, not seconds, particularly in ambient mode
or when the device isn't being worn,
update requests might come less frequently.
Try to make the update period as long as is reasonably possible.
Getting updates too often could impact battery life.
then you can just set this to zero.
And then you won't get any calls beyond the initial one.

00:24:30,940 Now one example where you might think
you want to update every minute is
where you are displaying something related
to the time on the watch face.
So here you can see two complications where
the text changes every minute.
We've got a world clock and the time to my next event.
But it would be wasteful to wake up the provider every minute.
And there's no guarantee that the update request
would come in at the point where the minute changes.
Even the date complication shouldn't need to update.
Even though it would only be once a day,
there's no guarantee the update will
come at the stroke of midnight.
So it would be showing incorrect data at certain times of day.
So instead, the API allows you to use time dependent text.
For text that represents the current time,
we have time format text.
And for text that represents the time to or from a given time,
use the time difference text.
Let's take a look at an example.

00:25:36,250 So let's say that we're building a complication showing
the time to my next meeting.
And we're using the short text type.
So I'm building the complication data of type short text.
We saw earlier that set short text takes
a complication text object.
And that's so that here we can pass in a different kind
of complication text object.
So we're going to use Time Difference
Builder to create one.
So passing into the builder, we need
to set the reference period.
That is the time that the text relates to.
So in this case it's the time of my next event.
Let's say that's from 4:00 PM until 5:00 PM.
In that case, start time here Is.
4:00 PM.
End time here is 5:00 PM.
So this just determines how the text is formatted,
is displayed.
In this case we're using short joule unit.
That means, for example, if the time
difference was five hours and 15 minutes, it would show 5H 15M.

00:26:43,809 That completes the time difference text.
So we call Build.
There's one more thing.
As I mentioned earlier, complication data
can cease to be valid after a certain time.
And that is the case here.
And it's particularly important here
because the time difference text is the time to the event,
but it's also the time since the event.
So if it were 10 minutes after my event,
then the complication might show 10M, which is not what we want.
So we have to set an end time so that it shows nothing
after the event.
OK, so that completes the complication data.
So we just call Build.
Let's see what that would look like on the watch face.
So, the event is at 4:00 PM.
One hour and 45 minutes before, we would see this.
At 3:45 PM, we would see this.
So although it's the short joule unit
style, when it's only minutes, we only show the minutes.
We never show seconds in this style.

00:27:50,750 During the event, we would show this.
So the time difference text actually shows the text now.
These strings, all of these strings
are localized according to the locale of the device.
After the event we see nothing.
Because we set the end time.
So for more details of the types and styles of time
dependent text, check out the complication text class
in the wearable support preview.

00:28:21,450 OK, so that's the Complications API for both data providers
and for watch faces.
We're really excited to see how you all make use of it.

00:28:29,896 TONY FERREIRA: Thanks.
So if you like what you've heard here today,
and you'd like to try it out, you can.
Just go to g.co/wearpreview.
You can find out about how to get the Preview SDK, device
The dev preview also includes this watch face.
It's called elements.
And it supports a variety of complication types.
So you can test any data providers you build.
The preview does include a few providers, like battery level,
world clock, and date.
You can use these to test the complications on your watch
face.
Here is a list of the Android Wear sessions
that were on today at I/O. And don't worry
if you've missed any of them, because they're

00:29:23,490 OLIN LAN: So if you'd like to have a go at creating a watch
face with complications or building a data provider,
do check out the code labs.
You can do them here at I/O. Or you can go
to g.co/codelabs/io16/wear.
We'd also love to hear any feedback you have on the API.
So if you find any bugs, or if you have any suggestions
or questions, please go to g.co/wearpreviewbug.
And finally, if you'd like to discuss the Complications API
or anything else about Android Wear with other developers,
go on to Android Wear developers G+ Community
at g.co/androidweardev.
OK, thank you very much.
[APPLAUSE]
[MUSIC PLAYING]
Subtitles End: mo.dbxdb.com


展开全文
• on the Android Wear team. 5 00:00:05,539 --> 00:00:07,080 TONY FERREIRA: And I'm Tony Ferreira, 6 00:00:07,080 --> 00:00:09,410 a designer on Android Wear. 7 00:00:...
1
00:00:00,000 --> 00:00:00,000

2
00:00:00,000 --> 00:00:00,000

3
00:00:00,499 --> 00:00:02,770
OLIN LAN: Hello, everybody.

4
00:00:02,770 --> 00:00:05,539
I'm Oli Lan, an engineer
on the Android Wear team.

5
00:00:05,539 --> 00:00:07,080
TONY FERREIRA: And
I'm Tony Ferreira,

6
00:00:07,080 --> 00:00:09,410
a designer on Android Wear.

7
00:00:09,410 --> 00:00:10,970
OLIN LAN: It's great to be here.

8
00:00:10,970 --> 00:00:13,470
We're really excited to tell
you about the new stuff coming

9
00:00:13,470 --> 00:00:15,340
to watch faces on Android Wear.

10
00:00:15,340 --> 00:00:17,970

11
00:00:17,970 --> 00:00:22,970
The watch face is at the heart
of the Android Wear interface.

12
00:00:22,970 --> 00:00:25,280
Of course, it tells the time.

13
00:00:25,280 --> 00:00:28,840
And with the thousands of

14
00:00:28,840 --> 00:00:32,860
it's a great way for users
to express their style.

15
00:00:32,860 --> 00:00:35,260
last year,

16
00:00:35,260 --> 00:00:39,520
and the watch face came
to life like never before.

17
00:00:39,520 --> 00:00:42,770
But the watch face can do more.

18
00:00:42,770 --> 00:00:45,670
As an always-on screen
that's just a glance away,

19
00:00:45,670 --> 00:00:49,200
it's a great place to get the

20
00:00:49,200 --> 00:00:51,770
And that's why we're
introducing the Complications

21
00:00:51,770 --> 00:00:55,160
API for Android Wear.

22
00:00:55,160 --> 00:00:58,420
TONY FERREIRA: But first of
all, what are Complications?

23
00:00:58,420 --> 00:01:00,940
That term comes from

24
00:01:00,940 --> 00:01:03,440
And it means, well,
pretty much anything

25
00:01:03,440 --> 00:01:06,650
that's not telling the time.

26
00:01:06,650 --> 00:01:09,110
Complications on
mechanical watches

27
00:01:09,110 --> 00:01:14,040
show things like the date, your
alarm, or phase of the moon.

28
00:01:14,040 --> 00:01:16,300
So the small dials
you see on this watch,

29
00:01:16,300 --> 00:01:18,500
they are complications.

30
00:01:18,500 --> 00:01:21,190
On smartwatches there
are new possibilities,

31
00:01:21,190 --> 00:01:27,330
like the weather, stock prices,

32
00:01:27,330 --> 00:01:29,370
OLIN LAN: Many watch
faces on Android Wear

33
00:01:29,370 --> 00:01:36,270
like Bits from usTwo or Legacy

34
00:01:36,270 --> 00:01:38,181
from Zuhanden.

35
00:01:38,181 --> 00:01:40,680
But as it stands,
each watch face

36
00:01:40,680 --> 00:01:44,040
has to go and get
the data itself.

37
00:01:44,040 --> 00:01:46,040
That could mean

38
00:01:46,040 --> 00:01:48,860
to find its own source
of weather data,

39
00:01:48,860 --> 00:01:53,610
or finance data, or anything
else you want to show.

40
00:01:53,610 --> 00:01:56,950
And if the user wants to see
something you haven't included,

41
00:01:56,950 --> 00:01:59,739
they're out of luck.

42
00:01:59,739 --> 00:02:02,040
Or maybe you're not a
watch face developer,

43
00:02:02,040 --> 00:02:05,560
but your app has data that would
be great on the watch face,

44
00:02:05,560 --> 00:02:09,699
like fitness stats
or finance info.

45
00:02:09,699 --> 00:02:12,139
As it stands, there's
no way to do this other

46
00:02:12,139 --> 00:02:14,460
than building your
own watch face

47
00:02:14,460 --> 00:02:16,710
or making deals with individual
watch face developers.

48
00:02:16,710 --> 00:02:19,500

49
00:02:19,500 --> 00:02:22,270
The Complications
API for Android Wear

50
00:02:22,270 --> 00:02:24,970
changes all of this.

51
00:02:24,970 --> 00:02:30,086
Apps using the API will be
data providers or watch faces.

52
00:02:30,086 --> 00:02:32,930

53
00:02:32,930 --> 00:02:36,630
If you build a watch face
using the Complications API,

54
00:02:36,630 --> 00:02:40,169
ecosystem of data providers.

55
00:02:40,169 --> 00:02:42,919
Here are just some of the

56
00:02:42,919 --> 00:02:45,910
on using the API.

57
00:02:45,910 --> 00:02:48,520
And if you build
a data provider,

58
00:02:48,520 --> 00:02:54,620
you can get your data on a
whole range of watch faces.

59
00:02:54,620 --> 00:02:58,039
there's a huge range

60
00:02:58,039 --> 00:02:59,900
of styles of watch faces.

61
00:02:59,900 --> 00:03:03,400
So there's no way
that just one style,

62
00:03:03,400 --> 00:03:08,150
one visual style of complication
would fit on every watch face.

63
00:03:08,150 --> 00:03:11,460
Because of that, with
the Complications API,

64
00:03:11,460 --> 00:03:14,550
the watch face gets to decide
how to render the data.

65
00:03:14,550 --> 00:03:17,020
It gets to choose the visual
style, the colors, the fonts,

66
00:03:17,020 --> 00:03:18,080
etc.

67
00:03:18,080 --> 00:03:20,590
The data provided just
provides raw fields

68
00:03:20,590 --> 00:03:25,199
like strings, text,
images, and numbers.

69
00:03:25,199 --> 00:03:27,416
Before we get into the
details of the API though,

70
00:03:27,416 --> 00:03:29,039
Tony is going to go
through some things

71
00:03:29,039 --> 00:03:32,650
designing for complications.

72
00:03:32,650 --> 00:03:35,246
TONY FERREIRA: Thanks, Oli.

73
00:03:35,246 --> 00:03:37,870
So some of you may have already
checked out the Material design

74
00:03:37,870 --> 00:03:39,599
spec for wearables.

75
00:03:39,599 --> 00:03:41,490
And there you'll find
a ton of useful things

76
00:03:41,490 --> 00:03:46,163
to help developers and designers
design for Android Wear.

77
00:03:46,163 --> 00:03:48,080
I'd like to highlight
some of the things, some

78
00:03:48,080 --> 00:03:50,246
of those design principles
that you'll find in there

79
00:03:50,246 --> 00:03:54,080
and how they apply
to complications.

80
00:03:54,080 --> 00:03:56,610
So the first design
principle is glanceable,

81
00:03:56,610 --> 00:04:00,099
making things clear
and understandable.

82
00:04:00,099 --> 00:04:04,479
For complications, small, easy

83
00:04:04,479 --> 00:04:06,240
work best.

84
00:04:06,240 --> 00:04:09,130
It's very important that the
information on the watch face

85
00:04:09,130 --> 00:04:13,360
is organized with a clear
hierarchy, large enough

86
00:04:13,360 --> 00:04:16,860
high enough in contrast.

87
00:04:16,860 --> 00:04:20,819
Users shouldn't need to

88
00:04:20,819 --> 00:04:23,720
The second design
principle is time saving,

89
00:04:23,720 --> 00:04:27,670
getting the information you want

90
00:04:27,670 --> 00:04:29,529

91
00:04:29,529 --> 00:04:31,470
to find the
information you want,

92
00:04:31,470 --> 00:04:33,560
with the introduction
of complications,

93
00:04:33,560 --> 00:04:36,810
it's right there
on the watch face.

94
00:04:36,810 --> 00:04:38,779
Complications are also tapable.

95
00:04:38,779 --> 00:04:42,089
So you can deep link to your
favorite contact or upcoming

96
00:04:42,089 --> 00:04:43,990
calendar event.

97
00:04:43,990 --> 00:04:46,149
And complications
are also persistent,

98
00:04:46,149 --> 00:04:49,230
there whenever you need them.

99
00:04:49,230 --> 00:04:52,500
The third design
principle is consistent.

100
00:04:52,500 --> 00:04:54,540
Complications should have
a healthy relationship

101
00:04:54,540 --> 00:04:56,440
with the watch face.

102
00:04:56,440 --> 00:04:59,990
As Oli just said, with
Complications on Android Wear,

103
00:04:59,990 --> 00:05:03,360
the watch face decides how the
complications are rendered.

104
00:05:03,360 --> 00:05:06,230
So they feel part
of the same family.

105
00:05:06,230 --> 00:05:08,410
Consider aligning the
style of the complications

106
00:05:08,410 --> 00:05:10,930
with the watch face.

107
00:05:10,930 --> 00:05:15,680
Oli is now going to talk you
through the complication types.

108
00:05:15,680 --> 00:05:17,370
OLIN LAN: Thanks, Tony.

109
00:05:17,370 --> 00:05:22,470
data, supplied by provider apps

110
00:05:22,470 --> 00:05:25,670
and displayed on watch faces.

111
00:05:25,670 --> 00:05:30,089
This could include numerical

112
00:05:30,089 --> 00:05:33,600
text like the title

113
00:05:33,600 --> 00:05:38,060
or images like an
icon or a profile pic.

114
00:05:38,060 --> 00:05:42,240
Not every type of data will
fit on every watch face.

115
00:05:42,240 --> 00:05:44,339
There might only be
space for a small icon

116
00:05:44,339 --> 00:05:46,990
or a short bit of text.

117
00:05:46,990 --> 00:05:49,769
Or you might want to use
numerical data without having

118
00:05:49,769 --> 00:05:52,930
to show text or images.

119
00:05:52,930 --> 00:05:56,449
So watch faces need to
say what they can display.

120
00:05:56,449 --> 00:06:00,220
And data providers need to
say what they can supply.

121
00:06:00,220 --> 00:06:05,380
To help with this, we've defined
a number of complication types.

122
00:06:05,380 --> 00:06:08,250
Complication types
determine what kinds of data

123
00:06:08,250 --> 00:06:09,800
are included.

124
00:06:09,800 --> 00:06:12,920
There's usually one field that's
the key piece of information.

125
00:06:12,920 --> 00:06:15,160
And we've named the
types after that field.

126
00:06:15,160 --> 00:06:18,916
So here you see examples
of the short text type.

127
00:06:18,916 --> 00:06:20,540
These are all short
text complications.

128
00:06:20,540 --> 00:06:22,720
But as you can see there
are optional elements.

129
00:06:22,720 --> 00:06:25,149
There may be an icon
or a second string.

130
00:06:25,149 --> 00:06:28,459
But the most important value
is contained in the short text

131
00:06:28,459 --> 00:06:30,980
field.

132
00:06:30,980 --> 00:06:33,399
If you're a data
provider, you can

133
00:06:33,399 --> 00:06:35,750
choose which of the
optional fields to include.

134
00:06:35,750 --> 00:06:37,699
But a short text
complication must always

135
00:06:37,699 --> 00:06:40,759
include the short text field.

136
00:06:40,759 --> 00:06:44,000
If you're building a watch face
and you support short text,

137
00:06:44,000 --> 00:06:48,290
you need to consider
all of these variations.

138
00:06:48,290 --> 00:06:50,019
Here are some other examples.

139
00:06:50,019 --> 00:06:53,100
You might not need any text
to convey the information.

140
00:06:53,100 --> 00:06:56,759
Then maybe the icon
type is enough.

141
00:06:56,759 --> 00:07:00,079
Or, if you have numerical
data within bounds

142
00:07:00,079 --> 00:07:03,180
like a percentage, then
the range value type

143
00:07:03,180 --> 00:07:06,230
could be for you.

144
00:07:06,230 --> 00:07:10,329
We also have a few other types.

145
00:07:10,329 --> 00:07:13,910
You'll notice that we have
bot icon and small image.

146
00:07:13,910 --> 00:07:16,759
The difference is that
images for the icon field

147
00:07:16,759 --> 00:07:18,589
should be tintable
by the watch face.

148
00:07:18,589 --> 00:07:21,600
They should be single color
with a transparent background.

149
00:07:21,600 --> 00:07:24,910
This allows the watch face to
fit it better to its style.

150
00:07:24,910 --> 00:07:27,690
So if you are building a
watch face where full color

151
00:07:27,690 --> 00:07:31,130
images won't match
the style, then you

152
00:07:31,130 --> 00:07:32,589
can support the icon type.

153
00:07:32,589 --> 00:07:35,089
But you might not want to
support the small image type,

154
00:07:35,089 --> 00:07:36,851
where images may be full color.

155
00:07:36,851 --> 00:07:39,406

156
00:07:39,406 --> 00:07:41,740
the different complication

157
00:07:41,740 --> 00:07:44,100
types, if you are
building a provider,

158
00:07:44,100 --> 00:07:47,029

159
00:07:47,029 --> 00:07:48,529
And if you're
building complications

160
00:07:48,529 --> 00:07:51,547
into a watch face, think
about how many of the types

161
00:07:51,547 --> 00:07:52,380
you want to support.

162
00:07:52,380 --> 00:07:55,399

163
00:07:55,399 --> 00:07:58,259
Now back to Tony to talk about
some more guidelines for what

164
00:07:58,259 --> 00:08:00,538
face developers.

165
00:08:00,538 --> 00:08:02,579
TONY FERREIRA: OK, so I
want to talk a little bit

166
00:08:02,579 --> 00:08:04,290
you should consider

167
00:08:04,290 --> 00:08:06,720
when designing complications.

168
00:08:06,720 --> 00:08:08,949
However, bear in mind
there isn't a one size

169
00:08:08,949 --> 00:08:11,110
fits all solution to this.

170
00:08:11,110 --> 00:08:14,180
We have a diverse collection
of watch faces on the platform.

171
00:08:14,180 --> 00:08:16,420
And we think it's important
that complications

172
00:08:16,420 --> 00:08:19,790
are flexible enough to
mirror that diversity.

173
00:08:19,790 --> 00:08:23,045
as a starting point.

174
00:08:23,045 --> 00:08:24,920
But if you feel your
watch face would benefit

175
00:08:24,920 --> 00:08:27,211
from deviating from these
guidelines, then by all means

176
00:08:27,211 --> 00:08:30,579

177
00:08:30,579 --> 00:08:33,538
Complication should never
conflict with the surrounding

178
00:08:33,538 --> 00:08:35,480
objects on the watch face.

179
00:08:35,480 --> 00:08:39,110
face layouts, as shown here,

180
00:08:39,110 --> 00:08:42,950
these red areas, in general,
shouldn't have complications.

181
00:08:42,950 --> 00:08:47,159
As it will be a conflict with
other parts of the watch face.

182
00:08:47,159 --> 00:08:49,529
a bit of space,

183
00:08:49,529 --> 00:08:51,919
so they have room
to breathe as well.

184
00:08:51,919 --> 00:08:54,909
And if possible, staying true to
the alignment of the watch face

185
00:08:54,909 --> 00:08:58,110
achieve better balance.

186
00:08:58,110 --> 00:09:00,070
So if you have a
center aligned clock,

187
00:09:00,070 --> 00:09:02,360
it might make sense to center
align the complications

188
00:09:02,360 --> 00:09:02,360
as well.

189
00:09:02,860 --> 00:09:05,659

190
00:09:05,659 --> 00:09:08,190
Complications can be
rendered however you wish.

191
00:09:08,190 --> 00:09:10,860
Though you might want

192
00:09:10,860 --> 00:09:14,269
a little more protection and
house them in a container.

193
00:09:14,269 --> 00:09:16,259
So we found these
form factors work well

194
00:09:16,259 --> 00:09:18,610
with the various data types.

195
00:09:18,610 --> 00:09:28,070
We have circle, square,
pill, and rectangle.

196
00:09:28,070 --> 00:09:32,269
And bear in mind, the size
and form of these containers

197
00:09:32,269 --> 00:09:36,899
decide what data types
can and can't be rendered.

198
00:09:36,899 --> 00:09:38,870
And containers are optional.

199
00:09:38,870 --> 00:09:39,799
Sometimes they help.

200
00:09:39,799 --> 00:09:41,200
Sometimes they don't.

201
00:09:41,200 --> 00:09:44,120
But the important thing to
remember, as a watch face

202
00:09:44,120 --> 00:09:46,269
developer, is you have
the freedom to choose.

203
00:09:46,269 --> 00:09:49,876

204
00:09:49,876 --> 00:09:51,960
Building a strong relationship
with the watch face

205
00:09:51,960 --> 00:09:54,095
is also very important.

206
00:09:54,095 --> 00:09:55,470
You don't want

207
00:09:55,470 --> 00:09:57,649
to seem like an afterthought.

208
00:09:57,649 --> 00:10:00,559
So here are some
things to consider.

209
00:10:00,559 --> 00:10:02,970
Use color to tint the data.

210
00:10:02,970 --> 00:10:07,029
This will help create better
harmony with the watch face.

211
00:10:07,029 --> 00:10:09,139
Decide whether your
complications need containers

212
00:10:09,139 --> 00:10:10,350
or not.

213
00:10:10,350 --> 00:10:12,289
You can see in this
example, in the middle,

214
00:10:12,289 --> 00:10:14,080
we've removed the
containers just

215
00:10:14,080 --> 00:10:16,730
to help the complications better
integrate into the watch face.

216
00:10:16,730 --> 00:10:19,330

217
00:10:19,330 --> 00:10:22,059
And play around with scale.

218
00:10:22,059 --> 00:10:25,320
better visual hierarchy.

219
00:10:25,320 --> 00:10:27,380
But most importantly,
on top of all that,

220
00:10:27,380 --> 00:10:28,408
just have fun with them.

221
00:10:28,408 --> 00:10:29,907
And don't be scared
to get creative.

222
00:10:29,907 --> 00:10:33,909

223
00:10:33,909 --> 00:10:36,710
You can have multiple
complications on a watch face.

224
00:10:36,710 --> 00:10:38,769
This is awesome
for those of us who

225
00:10:38,769 --> 00:10:42,620
want to surface lots of data.

226
00:10:42,620 --> 00:10:45,250
Here you can see we've
removed the containers

227
00:10:45,250 --> 00:10:46,149
to create more space.

228
00:10:46,149 --> 00:10:48,299
And we can easily fit
eight complications

229
00:10:48,299 --> 00:10:50,269
on a single watch face.

230
00:10:50,269 --> 00:10:53,570
If multiple complications is a
direction you wish to go down,

231
00:10:53,570 --> 00:10:56,299
just try to make sure that
things don't get too cluttered

232
00:10:56,299 --> 00:10:57,676
and the UI remains glanceable.

233
00:10:57,676 --> 00:11:00,250

234
00:11:00,250 --> 00:11:04,009
The Complications API can also
be used as a creative tool.

235
00:11:04,009 --> 00:11:06,009
With the ranged
value data type, you

236
00:11:06,009 --> 00:11:10,130
can abstract that data
whichever way you like.

237
00:11:10,130 --> 00:11:12,120
So in the example,
we've shown here,

238
00:11:12,120 --> 00:11:14,979
we display your step count goal.

239
00:11:14,979 --> 00:11:16,519
Throughout the day,
as you get closer

240
00:11:16,519 --> 00:11:18,309
to reaching your
step count goal,

241
00:11:18,309 --> 00:11:21,220
the graphic in the

242
00:11:21,220 --> 00:11:23,220
Presenting the
data like this, in

243
00:11:23,220 --> 00:11:25,899
an unconventional
and abstract way,

244
00:11:25,899 --> 00:11:28,490
opens the door for more fun
and engaging watch faces.

245
00:11:28,490 --> 00:11:31,259

246
00:11:31,259 --> 00:11:33,899
And just to finish,
here are a few examples

247
00:11:33,899 --> 00:11:36,320
of implemented
complications designed

248
00:11:36,320 --> 00:11:39,100
by our creative partners usTwo.

249
00:11:39,100 --> 00:11:40,909
In the first example
here, you can

250
00:11:40,909 --> 00:11:44,399
see they've kept things simple
and find a straightforward way

251
00:11:44,399 --> 00:11:47,960
a preexisting watch face,

252
00:11:47,960 --> 00:11:50,059
removing containers
and tinting the data.

253
00:11:50,059 --> 00:11:52,860

254
00:11:52,860 --> 00:11:56,169
The second example is
a little more bespoke.

255
00:11:56,169 --> 00:11:57,759
They've used their

256
00:11:57,759 --> 00:12:00,620
and played around with things
like the layout and the form

257
00:12:00,620 --> 00:12:01,919
factors.

258
00:12:01,919 --> 00:12:03,899
This helps better
align the complications

259
00:12:03,899 --> 00:12:05,652
with the watch face aesthetic.

260
00:12:05,652 --> 00:12:08,289

261
00:12:08,289 --> 00:12:11,370
In the last example, we have had
some fun with the range value

262
00:12:11,370 --> 00:12:15,120
data type, creating a really
cool generative abstract

263
00:12:15,120 --> 00:12:16,700
design.

264
00:12:16,700 --> 00:12:19,610
In this example, you can

265
00:12:19,610 --> 00:12:22,644
or battery level
being represented.

266
00:12:22,644 --> 00:12:24,059
I'll now hand you
over to Oli, who

267
00:12:24,059 --> 00:12:27,580
is going to talk you through
the details of the API.

268
00:12:27,580 --> 00:12:30,360
OLIN LAN: Thanks, Tony.

269
00:12:30,360 --> 00:12:35,210
OK, so let's take a look at
how this all fits together.

270
00:12:35,210 --> 00:12:39,120
Android Wear manages the flow
of data between data providers

271
00:12:39,120 --> 00:12:41,409
and watch faces.

272
00:12:41,409 --> 00:12:43,539
When data is needed
for a complication,

273
00:12:43,539 --> 00:12:45,779
Android Wear will
send an update request

274
00:12:45,779 --> 00:12:51,130
for a specific type of data.

275
00:12:51,130 --> 00:12:54,340
The provider builds a
complication data object

276
00:12:54,340 --> 00:12:57,549
of that type with

277
00:12:57,549 --> 00:13:00,889
and sends it back to Wear.

278
00:13:00,889 --> 00:13:03,470
Android Wear then forwards
that onto the watch face,

279
00:13:03,470 --> 00:13:07,820
which can then include
it when it renders.

280
00:13:07,820 --> 00:13:09,820
Android Wear also
provides the UI

281
00:13:09,820 --> 00:13:12,169
that allows users
to choose providers

282
00:13:12,169 --> 00:13:13,570
for each complication.

283
00:13:13,570 --> 00:13:16,090
And we'll talk

284
00:13:16,090 --> 00:13:17,960
But now let's take
a look at what you

285
00:13:17,960 --> 00:13:20,876
complications to a watch face.

286
00:13:20,876 --> 00:13:23,860

287
00:13:23,860 --> 00:13:25,649
So first of all,
you need to decide

288
00:13:25,649 --> 00:13:27,899
how many complications
to include

289
00:13:27,899 --> 00:13:31,529
and what types to
support in each one.

290
00:13:31,529 --> 00:13:33,049
So, for this example,
let's say you

291
00:13:33,049 --> 00:13:37,970
want to include a small round
complication on the right.

292
00:13:37,970 --> 00:13:42,320
Now in that space we
could support short text.

293
00:13:42,320 --> 00:13:46,179
We could also support icon.

294
00:13:46,179 --> 00:13:51,519
And there's also enough space
there to show a ranged value.

295
00:13:51,519 --> 00:13:53,720
Now in that space we
could, if we wanted,

296
00:13:53,720 --> 00:13:55,090
support small image as well.

297
00:13:55,090 --> 00:13:59,630
But let's say for this
example that we don't want to.

298
00:13:59,630 --> 00:14:01,450
Now let's say we
also want to include

299
00:14:01,450 --> 00:14:04,590
a complication at the bottom.

300
00:14:04,590 --> 00:14:09,100
This one could support the
same types as the first one.

301
00:14:09,100 --> 00:14:12,720
But there's also enough
space to make this one wider.

302
00:14:12,720 --> 00:14:16,149
So it could support
the long text type.

303
00:14:16,149 --> 00:14:18,509
Note that we consider this
to be the same complication.

304
00:14:18,509 --> 00:14:22,940
Even though it's a different
shape, depending on the type.

305
00:14:22,940 --> 00:14:25,630
So to summarizes, these
are the types supported

306
00:14:25,630 --> 00:14:28,966
by each of those complications.

307
00:14:28,966 --> 00:14:31,049
One more thing, you need
to give each complication

308
00:14:31,049 --> 00:14:36,190
a numerical ID so that you can
refer to it with the system.

309
00:14:36,190 --> 00:14:38,350
That's chosen by the watch face.

310
00:14:38,350 --> 00:14:40,730
We call it the watch
face complication ID,

311
00:14:40,730 --> 00:14:44,299
and it can be any integer.

312
00:14:44,299 --> 00:14:47,710
OK, so next you need
a way for the user

313
00:14:47,710 --> 00:14:49,860
to choose providers
for each complication.

314
00:14:49,860 --> 00:14:53,059

315
00:14:53,059 --> 00:14:54,590
As I mentioned
earlier, Android Wear

316
00:14:54,590 --> 00:14:57,470
provides the UI to
choose a provider

317
00:14:57,470 --> 00:14:59,700
for a particular complication.

318
00:14:59,700 --> 00:15:02,519
But the rest of the
UI is up to you.

319
00:15:02,519 --> 00:15:05,490
So what we're showing
here on the slide

320
00:15:05,490 --> 00:15:08,769
is a basic list that could be
part of the watch faces config

321
00:15:08,769 --> 00:15:09,269
activity.

322
00:15:09,269 --> 00:15:11,190
It's the watch
face's own settings.

323
00:15:11,190 --> 00:15:15,450
So this screen is not
provided by the system.

324
00:15:15,450 --> 00:15:17,980
So when the user taps
on item in this list,

325
00:15:17,980 --> 00:15:23,279
the watch face needs to launch
that system provider chooser.

326
00:15:23,279 --> 00:15:24,460
Let's look at some code.

327
00:15:24,460 --> 00:15:28,929
So, in order to do that, you
use this support library method

328
00:15:28,929 --> 00:15:30,200
to get hold of an intent.

329
00:15:30,200 --> 00:15:31,658
That's
createProviderChooserIntent.

330
00:15:31,658 --> 00:15:33,830

331
00:15:33,830 --> 00:15:36,880
You pass in the watch
face component name.

332
00:15:36,880 --> 00:15:39,730
That's the package and class

333
00:15:39,730 --> 00:15:42,360
That's just how you refer to
your watch face to the system.

334
00:15:42,360 --> 00:15:45,500
And you also pass in the
watch face complication

335
00:15:45,500 --> 00:15:49,460
ID for the complication
that is being configured.

336
00:15:49,460 --> 00:15:53,120
So that's the number
we chose earlier.

337
00:15:53,120 --> 00:15:59,299
You then pass in the types
supported by that complication.

338
00:15:59,299 --> 00:16:01,460
In this list, the
order doesn't matter.

339
00:16:01,460 --> 00:16:03,049
You list them in
order of preference,

340
00:16:03,049 --> 00:16:05,870
with the most
preferred coming first.

341
00:16:05,870 --> 00:16:08,759
In this example, we've put
ranged value at the top.

342
00:16:08,759 --> 00:16:10,759
That's because that
type conveys the most

343
00:16:10,759 --> 00:16:11,960
information to the user.

344
00:16:11,960 --> 00:16:13,210
So that's often a good choice.

345
00:16:13,210 --> 00:16:16,110
And that's a good way

346
00:16:16,110 --> 00:16:16,110
OK.

347
00:16:16,610 --> 00:16:18,029
So then when you
have the intent,

348
00:16:18,029 --> 00:16:21,820
you call
startActivityforResult to show

349
00:16:21,820 --> 00:16:24,309
the system provide chooser.

350
00:16:24,309 --> 00:16:27,960
So, when the user taps
on an item in this list,

351
00:16:27,960 --> 00:16:31,029
the system provider
choose is shown.

352
00:16:31,029 --> 00:16:34,950
Now when the user chooses
a provider in this UI,

353
00:16:34,950 --> 00:16:37,039
it gets setup automatically.

354
00:16:37,039 --> 00:16:40,509
You don't need to
do anything else.

355
00:16:40,509 --> 00:16:43,080
OK, so to show the data,
what you need to do

356
00:16:43,080 --> 00:16:44,659
is tell the system

357
00:16:44,659 --> 00:16:46,559

358
00:16:46,559 --> 00:16:48,820
So let's move into
the watch face service

359
00:16:48,820 --> 00:16:52,460
itself, specifically the engine.

360
00:16:52,460 --> 00:16:56,710
So what you need to do is
call setActiveComplications,

361
00:16:56,710 --> 00:16:59,179
and pass in the watch
face complication

362
00:16:59,179 --> 00:17:03,690
IDs for the complications

363
00:17:03,690 --> 00:17:08,638
Here we're showing in
onCreate of the engine.

364
00:17:08,638 --> 00:17:10,180
That's usually a
good place to do it.

365
00:17:10,180 --> 00:17:12,250
But you can call this
method from elsewhere.

366
00:17:12,250 --> 00:17:14,919
For example, if the active
complications change.

367
00:17:14,919 --> 00:17:17,450

368
00:17:17,450 --> 00:17:22,700
Once you've done that, you will
start to receive data in calls

369
00:17:22,700 --> 00:17:25,838
to the on complication
data update method.

370
00:17:25,838 --> 00:17:28,680

371
00:17:28,680 --> 00:17:31,680
The data will come with the
watch face complication ID

372
00:17:31,680 --> 00:17:34,160
that it relates to.

373
00:17:34,160 --> 00:17:36,339
data when it changes.

374
00:17:36,339 --> 00:17:39,880
So you'll have to hold onto
the complication data object.

375
00:17:39,880 --> 00:17:43,950
And any images, such as icons,

376
00:17:43,950 --> 00:17:46,980
and be sure to catch them.

377
00:17:46,980 --> 00:17:49,049
Now once you've got the
data, it's up to you

378
00:17:49,049 --> 00:17:51,380
how to incorporate it

379
00:17:51,380 --> 00:17:52,880
But before rendering
it, you need

380
00:17:52,880 --> 00:17:56,029
to check if the data
is still active.

381
00:17:56,029 --> 00:17:59,859
Some complication data is only
valid until a certain time.

382
00:17:59,859 --> 00:18:02,940
So for example, it might be
for a next event complication.

383
00:18:02,940 --> 00:18:05,789
And then the piece of
data will only be relevant

384
00:18:05,789 --> 00:18:08,910
up until the end of that event.

385
00:18:08,910 --> 00:18:12,180
You check it using
this method, the

386
00:18:12,180 --> 00:18:14,579
is active method on
the complication data.

387
00:18:14,579 --> 00:18:16,549
So you just pass
in the current time

388
00:18:16,549 --> 00:18:19,130
when you're drawing a
frame to see if you still

389
00:18:19,130 --> 00:18:21,936
need to draw that data.

390
00:18:21,936 --> 00:18:23,519
There's one other
thing you should do,

391
00:18:23,519 --> 00:18:27,730
which is to check to see if
complications are tapped on.

392
00:18:27,730 --> 00:18:30,200
You do this using the
interactive watch face's APIs

393
00:18:30,200 --> 00:18:32,430
that we announced last year.

394
00:18:32,430 --> 00:18:37,309
So that is by implementing
onTap command.

395
00:18:37,309 --> 00:18:39,539
If a complication is
tapped on, then you

396
00:18:39,539 --> 00:18:43,569
need to check the complication
data to see if it specifies

397
00:18:43,569 --> 00:18:47,359
a tap action pending intent.

398
00:18:47,359 --> 00:18:49,890
If there is one, you need
to fire that intent when

399
00:18:49,890 --> 00:18:52,299
the computation is tapped on.

400
00:18:52,299 --> 00:18:54,869
from the complication

401
00:18:54,869 --> 00:18:56,832
straight into a
relevant activity.

402
00:18:56,832 --> 00:19:00,528

403
00:19:00,528 --> 00:19:03,509
OK, so that's how

404
00:19:03,509 --> 00:19:05,519

405
00:19:05,519 --> 00:19:08,359
One important tip that goes
for watch phase development

406
00:19:08,359 --> 00:19:10,940
in general, but particularly
for complications,

407
00:19:10,940 --> 00:19:14,730
is minimize the work you
do in every draw call,

408
00:19:14,730 --> 00:19:18,619
especially if you're drawing
more than once a second.

409
00:19:18,619 --> 00:19:22,019
Avoid object creation in
On Draw wherever possible.

410
00:19:22,019 --> 00:19:24,589
As that can lead to a lot of
garbage collection and, hence,

411
00:19:24,589 --> 00:19:27,690
poor performance.

412
00:19:27,690 --> 00:19:31,920
OK, so now let's take a look
at how to build a complication

413
00:19:31,920 --> 00:19:32,644
data provider.

414
00:19:32,644 --> 00:19:35,950

415
00:19:35,950 --> 00:19:38,599
A data provider is a service.

416
00:19:38,599 --> 00:19:42,279
And to create one, you need to
extend complication provider

417
00:19:42,279 --> 00:19:44,643
service from the
support library.

418
00:19:44,643 --> 00:19:47,289

419
00:19:47,289 --> 00:19:51,154
This class has one abstract
method that you must implement.

420
00:19:51,154 --> 00:19:55,240

421
00:19:55,240 --> 00:19:59,480
This method is called whenever
the system wants data from you.

422
00:19:59,480 --> 00:20:02,230
So it will be called
when a complication using

423
00:20:02,230 --> 00:20:03,910

424
00:20:03,910 --> 00:20:06,099
By which I mean, when
the watch face calls

425
00:20:06,099 --> 00:20:08,559
Set Active Complications.

426
00:20:08,559 --> 00:20:11,019
And it will also be called

427
00:20:11,019 --> 00:20:15,779
chosen for a complication

428
00:20:15,779 --> 00:20:18,140
It can also be called
with a certain frequency,

429
00:20:18,140 --> 00:20:21,839
such as every hour, if
that's what you want.

430
00:20:21,839 --> 00:20:24,750
And it's also possible

431
00:20:24,750 --> 00:20:26,769
if you need a push style.

432
00:20:26,769 --> 00:20:28,970
For example, if you
have a messaging app,

433
00:20:28,970 --> 00:20:32,000
and you want to update a
complication when a message

434
00:20:32,000 --> 00:20:34,930
arrives, you could do this.

435
00:20:34,930 --> 00:20:37,329
on that then check out

436
00:20:37,329 --> 00:20:41,089
the provider update request
class in the previous support

437
00:20:41,089 --> 00:20:43,440
library.

438
00:20:43,440 --> 00:20:46,559
OK, so let's take a look
at an example of how you

439
00:20:46,559 --> 00:20:48,049
might implement this method.

440
00:20:48,049 --> 00:20:52,029
So you'll see that one of
the parameters is the type.

441
00:20:52,029 --> 00:20:55,369
That's the complication
type that's required.

442
00:20:55,369 --> 00:20:58,319
And the first thing we're
going to do is check that.

443
00:20:58,319 --> 00:21:01,130
Now in this example, we're only
going to support short text.

444
00:21:01,130 --> 00:21:02,880
In a real world example
you would probably

445
00:21:02,880 --> 00:21:04,612
support more than one type.

446
00:21:04,612 --> 00:21:07,920

447
00:21:07,920 --> 00:21:11,750
So first thing now is we start
building a complication data

448
00:21:11,750 --> 00:21:17,210
object of that type,
type short text.

449
00:21:17,210 --> 00:21:19,250
And now we're setting
the short text

450
00:21:19,250 --> 00:21:21,976
field, which is the required
field for this type.

451
00:21:21,976 --> 00:21:26,119
And we do it assessing it
to a simple string, "hello."

452
00:21:26,119 --> 00:21:28,890
You'll notice that it's wrapped
here is a complication text

453
00:21:28,890 --> 00:21:29,736
object.

454
00:21:29,736 --> 00:21:33,990
All of the set methods for
text in complication data

455
00:21:33,990 --> 00:21:37,069
take one of these
complication text objects.

456
00:21:37,069 --> 00:21:41,099
It can just be a wrapper for
simple string or char sequence.

457
00:21:41,099 --> 00:21:43,079
It can also be used
for other things.

458
00:21:43,079 --> 00:21:44,932
that a bit later.

459
00:21:44,932 --> 00:21:48,029

460
00:21:48,029 --> 00:21:51,390
OK, so we're also going
to specify an icon.

461
00:21:51,390 --> 00:21:55,190
That's an optional
field for short text.

462
00:21:55,190 --> 00:21:58,859
All of the image set methods
for complication data

463
00:21:58,859 --> 00:22:01,839
use the icon class from
the Android framework.

464
00:22:01,839 --> 00:22:03,809
That allows it to
be either a wrapper

465
00:22:03,809 --> 00:22:06,109
for a resource from

466
00:22:06,109 --> 00:22:08,589
a drawable resource.

467
00:22:08,589 --> 00:22:12,109
Or it could also be a bitmap.

468
00:22:12,109 --> 00:22:15,369
However, as I mentioned
earlier, the icon field images

469
00:22:15,369 --> 00:22:16,740
should always be tintable.

470
00:22:16,740 --> 00:22:20,380
They should be single color
with a transparent background.

471
00:22:20,380 --> 00:22:25,069
And we strongly recommend you
use vector drawables for this.

472
00:22:25,069 --> 00:22:28,670
That's because the watch
face could draw the icon

473
00:22:28,670 --> 00:22:29,670
at different sizes.

474
00:22:29,670 --> 00:22:32,241
And using a vector will
allow it to resize cleanly.

475
00:22:32,241 --> 00:22:35,170

476
00:22:35,170 --> 00:22:37,589
OK, so that completes
the complication data

477
00:22:37,589 --> 00:22:39,990
object for this example.

478
00:22:39,990 --> 00:22:43,250
All you need to do next is
send that data to the system.

479
00:22:43,250 --> 00:22:45,720
And you do that using
the complication manager

480
00:22:45,720 --> 00:22:48,309
object, which is passed
in as a parameter

481
00:22:48,309 --> 00:22:49,688
to on complication update.

482
00:22:49,688 --> 00:22:53,589

483
00:22:53,589 --> 00:22:56,460
OK, there are two other
methods that you can optionally

484
00:22:56,460 --> 00:22:58,049
implement.

485
00:22:58,049 --> 00:23:02,578
They are,
onComplicationActivated

486
00:23:02,578 --> 00:23:03,619
onComplicationDeactivate.

487
00:23:03,619 --> 00:23:07,519

488
00:23:07,519 --> 00:23:10,880
Complications are activated when
the watch face calls Set Active

489
00:23:10,880 --> 00:23:12,059
Complications.

490
00:23:12,059 --> 00:23:14,720
And they are deactivated
either by another call

491
00:23:14,720 --> 00:23:17,940
to Set Active Complications
with different IDs

492
00:23:17,940 --> 00:23:19,917
or when the user
changes watch face.

493
00:23:19,917 --> 00:23:23,059

494
00:23:23,059 --> 00:23:25,759
Now, as a service,

495
00:23:25,759 --> 00:23:27,332
to be declared in the manifest.

496
00:23:27,332 --> 00:23:31,180
And that's also where you use

497
00:23:31,180 --> 00:23:35,470
like what types you can
support and what update period

498
00:23:35,470 --> 00:23:38,180
you would like, if any.

499
00:23:38,180 --> 00:23:40,878
Here, with the supported types,
the order does not matter.

500
00:23:40,878 --> 00:23:42,670
And that's because, as
I mentioned earlier,

501
00:23:42,670 --> 00:23:45,880
the watch face gets to decide
the order of preference

502
00:23:45,880 --> 00:23:49,160
for any particular complication.

503
00:23:49,160 --> 00:23:52,059
Now for the update period, be
aware that the update period

504
00:23:52,059 --> 00:23:54,614
is not guaranteed.

505
00:23:54,614 --> 00:23:55,529
We do apply a minimum.

506
00:23:55,529 --> 00:23:57,039
The system applies a minimum.

507
00:23:57,039 --> 00:23:58,829
So you should think
in terms of minutes

508
00:23:58,829 --> 00:24:03,859
or longer, not seconds,
particularly in ambient mode

509
00:24:03,859 --> 00:24:05,990
or when the device
isn't being worn,

510
00:24:05,990 --> 00:24:10,079
update requests might
come less frequently.

511
00:24:10,079 --> 00:24:13,680
Try to make the update period as
long as is reasonably possible.

512
00:24:13,680 --> 00:24:17,960
could impact battery life.

513
00:24:17,960 --> 00:24:21,130

514
00:24:21,130 --> 00:24:23,059
then you can just
set this to zero.

515
00:24:23,059 --> 00:24:25,599
And then you won't get any
calls beyond the initial one.

516
00:24:25,599 --> 00:24:28,559

517
00:24:28,559 --> 00:24:30,940
Now one example
where you might think

518
00:24:30,940 --> 00:24:32,960
you want to update
every minute is

519
00:24:32,960 --> 00:24:34,920
where you are displaying
something related

520
00:24:34,920 --> 00:24:37,769
to the time on the watch face.

521
00:24:37,769 --> 00:24:41,319
So here you can see
two complications where

522
00:24:41,319 --> 00:24:43,789
the text changes every minute.

523
00:24:43,789 --> 00:24:48,410
We've got a world clock and
the time to my next event.

524
00:24:48,410 --> 00:24:51,759
But it would be wasteful to wake
up the provider every minute.

525
00:24:51,759 --> 00:24:54,339
And there's no guarantee
that the update request

526
00:24:54,339 --> 00:24:58,529
would come in at the point
where the minute changes.

527
00:24:58,529 --> 00:25:01,890
Even the date complication
shouldn't need to update.

528
00:25:01,890 --> 00:25:03,900
Even though it would
only be once a day,

529
00:25:03,900 --> 00:25:05,400
there's no guarantee
the update will

530
00:25:05,400 --> 00:25:07,220
come at the stroke of midnight.

531
00:25:07,220 --> 00:25:11,779
So it would be showing incorrect
data at certain times of day.

532
00:25:11,779 --> 00:25:16,660
So instead, the API allows you
to use time dependent text.

533
00:25:16,660 --> 00:25:19,089
For text that represents
the current time,

534
00:25:19,089 --> 00:25:21,970
we have time format text.

535
00:25:21,970 --> 00:25:26,259
And for text that represents the
time to or from a given time,

536
00:25:26,259 --> 00:25:29,346
use the time difference text.

537
00:25:29,346 --> 00:25:30,680
Let's take a look at an example.

538
00:25:30,680 --> 00:25:33,869

539
00:25:33,869 --> 00:25:36,250
So let's say that we're
building a complication showing

540
00:25:36,250 --> 00:25:38,410
the time to my next meeting.

541
00:25:38,410 --> 00:25:40,269
And we're using the
short text type.

542
00:25:40,269 --> 00:25:45,529
So I'm building the complication
data of type short text.

543
00:25:45,529 --> 00:25:47,809
We saw earlier that
set short text takes

544
00:25:47,809 --> 00:25:51,029
a complication text object.

545
00:25:51,029 --> 00:25:53,589
And that's so that here we
can pass in a different kind

546
00:25:53,589 --> 00:25:55,558
of complication text object.

547
00:25:55,558 --> 00:25:57,099
So we're going to
use Time Difference

548
00:25:57,099 --> 00:26:00,380
Builder to create one.

549
00:26:00,380 --> 00:26:02,799
So passing into the
builder, we need

550
00:26:02,799 --> 00:26:04,750
to set the reference period.

551
00:26:04,750 --> 00:26:07,079
That is the time that
the text relates to.

552
00:26:07,079 --> 00:26:11,250
So in this case it's the
time of my next event.

553
00:26:11,250 --> 00:26:14,279
Let's say that's from
4:00 PM until 5:00 PM.

554
00:26:14,279 --> 00:26:15,759
In that case,
start time here Is.

555
00:26:15,759 --> 00:26:16,670
4:00 PM.

556
00:26:16,670 --> 00:26:19,920
End time here is 5:00 PM.

557
00:26:19,920 --> 00:26:22,210

558
00:26:22,210 --> 00:26:26,690
So this just determines
how the text is formatted,

559
00:26:26,690 --> 00:26:27,799
is displayed.

560
00:26:27,799 --> 00:26:30,670
In this case we're
using short joule unit.

561
00:26:30,670 --> 00:26:32,660
That means, for
example, if the time

562
00:26:32,660 --> 00:26:36,690
difference was five hours and 15
minutes, it would show 5H 15M.

563
00:26:36,690 --> 00:26:40,180

564
00:26:40,180 --> 00:26:43,809
That completes the
time difference text.

565
00:26:43,809 --> 00:26:45,059
So we call Build.

566
00:26:45,059 --> 00:26:46,619
There's one more thing.

567
00:26:46,619 --> 00:26:49,809
As I mentioned earlier,
complication data

568
00:26:49,809 --> 00:26:52,519
can cease to be valid
after a certain time.

569
00:26:52,519 --> 00:26:53,980
And that is the case here.

570
00:26:53,980 --> 00:26:56,000
And it's particularly
important here

571
00:26:56,000 --> 00:26:59,799
because the time difference
text is the time to the event,

572
00:26:59,799 --> 00:27:02,299
but it's also the
time since the event.

573
00:27:02,299 --> 00:27:05,319
So if it were 10
minutes after my event,

574
00:27:05,319 --> 00:27:09,430
then the complication might show
10M, which is not what we want.

575
00:27:09,430 --> 00:27:12,089
So we have to set an end
time so that it shows nothing

576
00:27:12,089 --> 00:27:14,690
after the event.

577
00:27:14,690 --> 00:27:17,329
OK, so that completes
the complication data.

578
00:27:17,329 --> 00:27:20,880
So we just call Build.

579
00:27:20,880 --> 00:27:24,890
Let's see what that would
look like on the watch face.

580
00:27:24,890 --> 00:27:27,890
So, the event is at 4:00 PM.

581
00:27:27,890 --> 00:27:33,609
One hour and 45 minutes
before, we would see this.

582
00:27:33,609 --> 00:27:37,789
At 3:45 PM, we would see this.

583
00:27:37,789 --> 00:27:40,039
So although it's
the short joule unit

584
00:27:40,039 --> 00:27:43,230
style, when it's only minutes,
we only show the minutes.

585
00:27:43,230 --> 00:27:45,109
We never show seconds
in this style.

586
00:27:45,109 --> 00:27:47,940

587
00:27:47,940 --> 00:27:50,750
During the event,
we would show this.

588
00:27:50,750 --> 00:27:54,612
So the time difference text
actually shows the text now.

589
00:27:54,612 --> 00:27:56,069
These strings, all
of these strings

590
00:27:56,069 --> 00:28:00,789
are localized according to
the locale of the device.

591
00:28:00,789 --> 00:28:02,970
After the event we see nothing.

592
00:28:02,970 --> 00:28:05,960
Because we set the end time.

593
00:28:05,960 --> 00:28:09,349
So for more details of the
types and styles of time

594
00:28:09,349 --> 00:28:12,880
dependent text, check out
the complication text class

595
00:28:12,880 --> 00:28:14,500
in the wearable support preview.

596
00:28:14,500 --> 00:28:17,230

597
00:28:17,230 --> 00:28:21,450
OK, so that's the Complications
API for both data providers

598
00:28:21,450 --> 00:28:23,029
and for watch faces.

599
00:28:23,029 --> 00:28:25,695
We're really excited to see
how you all make use of it.

600
00:28:25,695 --> 00:28:28,809

601
00:28:28,809 --> 00:28:29,896
TONY FERREIRA: Thanks.

602
00:28:29,896 --> 00:28:31,730
So if you like what
you've heard here today,

603
00:28:31,730 --> 00:28:34,039
and you'd like to
try it out, you can.

604
00:28:34,039 --> 00:28:38,710
Just go to g.co/wearpreview.

605
00:28:38,710 --> 00:28:43,230
You can find out about how to
get the Preview SDK, device

606
00:28:43,230 --> 00:28:47,359

607
00:28:47,359 --> 00:28:50,150
The dev preview also
includes this watch face.

608
00:28:50,150 --> 00:28:51,910
It's called elements.

609
00:28:51,910 --> 00:28:54,940
And it supports a variety
of complication types.

610
00:28:54,940 --> 00:28:59,009
So you can test any data
providers you build.

611
00:28:59,009 --> 00:29:03,099
The preview does include a few
providers, like battery level,

612
00:29:03,099 --> 00:29:05,546
world clock, and date.

613
00:29:05,546 --> 00:29:07,920
You can use these to test the

614
00:29:07,920 --> 00:29:10,569
face.

615
00:29:10,569 --> 00:29:12,569
Here is a list of the
Android Wear sessions

616
00:29:12,569 --> 00:29:14,320
that were on today at
I/O. And don't worry

617
00:29:14,320 --> 00:29:16,194
if you've missed any of
them, because they're

618
00:29:16,194 --> 00:29:17,346

619
00:29:17,346 --> 00:29:21,031

620
00:29:21,031 --> 00:29:23,490
OLIN LAN: So if you'd like to
have a go at creating a watch

621
00:29:23,490 --> 00:29:27,029
face with complications or
building a data provider,

622
00:29:27,029 --> 00:29:28,269
do check out the code labs.

623
00:29:28,269 --> 00:29:30,910
You can do them here
at I/O. Or you can go

624
00:29:30,910 --> 00:29:36,900
to g.co/codelabs/io16/wear.

625
00:29:36,900 --> 00:29:40,089
We'd also love to hear any
feedback you have on the API.

626
00:29:40,089 --> 00:29:43,119
So if you find any bugs, or
if you have any suggestions

627
00:29:43,119 --> 00:29:48,596
to g.co/wearpreviewbug.

628
00:29:48,596 --> 00:29:52,140
And finally, if you'd like to
discuss the Complications API

629
00:29:52,140 --> 00:29:55,569
Wear with other developers,

630
00:29:55,569 --> 00:29:58,700
go on to Android Wear
developers G+ Community

631
00:29:58,700 --> 00:30:02,640
at g.co/androidweardev.

632
00:30:02,640 --> 00:30:03,819
OK, thank you very much.

633
00:30:03,819 --> 00:30:05,319
[APPLAUSE]

634
00:30:05,319 --> 00:30:09,269
[MUSIC PLAYING]

635
00:30:09,269 --> 00:30:20,000
Subtitles End: mo.dbxdb.com


展开全文
• Collection  中。   代码如下： [java]   view plain copy NotificationCompat.BigTextStyle bigTextStyle =  new    NotificationCompat....
• When you'd like to provide more information without requiring users to open your app on their handheld device, you can add one or more pages to the notification on Android Wear. The additional pages ...
• Christian Louboutin Spring Summer 2011 Shoes Collection Christian Louboutin Shoes sale Bold colors, buttons, Christian Louboutin, Christian Louboutin shoes, cute bows, electric blue suede...
• The particular collection with the bottle cork isn't going to injury the birkenstock outlet Oak along with provides for brand-new sound off growing again, commencing the life span circuit again. ...
• Lying is the first step to the gallows. 说谎是上断头台的第一步。 Waste not,want not.... 俭以防匮。...From saving comes having....A penny saved is a penny gained....Take care of the pence and the ...
• you can wear with Abercrombie shirt, or vice versa jeans 08:44:46.You can also look for matriculation students to wear one day and see the future more grease.The rules have changed when it comes to ...
• like an A-line shift by Tory Burch and a cerulean Calvin Klein Collection cocktail number with a peek-a-boo shoulder. 'Pregnant or not, your tailor is your best friend,' said Erin Walsh, Ms. ...
• Android Wear 支持多个可穿戴设备连接到一个手持端的设备，例如当用户保存了一个记事本到了手持端，这个会自动的出现在用户的两 个可穿戴的设备上面，为了让设备之间进行同步，谷歌服务器 主持了一个云端的node在...
• An Android Wear device or Wear AVD The Android v4 support library (or v13, which includes v4) You should also read Android Wear Design Principles When an Android handheld...
• 以下是获取所有的和Android Wear应用相连接的节点. private Collection getNodes() { HashSet <String>results = new HashSet (); NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi....
• 1. White FlagI know you think that I shouldn't still love youI tell you thatBut if I didn't say itWell, I'd still...
• Collection mode heat pipe and zipper fins at present there are mainly two kinds, respectively is welding (Solder) and wear a Fin (Fin Penetration), welding process of the interface zipper resistance i...
• e-NAND has the built-in intelligent controller which manages interface protocols, wear leveling, bad block management, garbage collection, and ECC. e-NAND protects the data contents from the host ...
• ## BeautyGAN论文翻译

千次阅读 2019-11-06 11:44:50
In daily life, celebrities always wear beautiful makeup styles,which give some examples to refer to. Makeup transfer provides an efficient way to help users select the most suitable makeup style. As ...
• This book is a collection of such efforts we made in the Chinese University of Hong Kong. We call this research area Intelligent Wearable Interfaces. Namely, we would like to develop interfaces with a...
• Android_PullToRefreshLibrary_Collection  – 下拉刷新开源库集锦 。 HitBlockRefresh  – 下拉刷新：打砖块和打坦克。 模糊效果 BlurNavigationDrawer  – 背景模糊的Navigation Drawer。 HUD与Toast ...

...