xref: /aosp_15_r20/developers/build/prebuilts/gradle/WatchFace/README.md (revision d353a188ca6ec4b5eba25b5fbd7bcb8ce61322fb)
1*d353a188SXin Li
2*d353a188SXin LiAndroid WatchFace Sample
3*d353a188SXin Li===================================
4*d353a188SXin Li
5*d353a188SXin LiA simple sample that demonstrates watch faces and complications for Wear 2.0.
6*d353a188SXin Li
7*d353a188SXin LiIntroduction
8*d353a188SXin Li------------
9*d353a188SXin Li
10*d353a188SXin LiThis sample demonstrates how to create watch faces for Android Wear.
11*d353a188SXin Li
12*d353a188SXin LiThe analog watch face covers best practices for Wear 2.0 including complications and a new
13*d353a188SXin Liconfiguration Activity for configuring both the watch face styles and the complications themselves.
14*d353a188SXin LiWe recommend you reuse the configuration code and follow the UX patterns in your watch face's
15*d353a188SXin Liconfiguration activity. You can see a preview in the screenshots section of the README.
16*d353a188SXin Li
17*d353a188SXin LiThe analog watch face has three main classes:
18*d353a188SXin Li
19*d353a188SXin Li- AnalogComplicationWatchFaceService.java (watchface folder) - Renders the watch face and active
20*d353a188SXin Licomplications.
21*d353a188SXin Li
22*d353a188SXin Li- AnalogComplicationConfigActivity.java (config folder) - Allows user to adjust watch face settings
23*d353a188SXin Li(arm and background colors) and watch face complications.
24*d353a188SXin Li
25*d353a188SXin Li- AnalogComplicationConfigData.java (models folder) - Populates the configuration screen in the
26*d353a188SXin Liprevious step by returning a list of items. Each item represents something you can customize on the
27*d353a188SXin Liwatch face. Items include a preview of the watch face (where you can pick your complications),
28*d353a188SXin Limarker color, background color, unread notifications, and background image complication. You can
29*d353a188SXin Liextend this and add your own.
30*d353a188SXin Li
31*d353a188SXin Li
32*d353a188SXin LiWe include several older watch faces to show best practices for Wear 1.0. If you are targeting
33*d353a188SXin Liolder devices, you may want to review those watch faces (digital, opengl, and interactive).
34*d353a188SXin Li
35*d353a188SXin LiThe digital watch face includes a watch-side and phone-side configuration example.
36*d353a188SXin Li
37*d353a188SXin LiThis sample includes both a phone app and a wearable app.
38*d353a188SXin Li
39*d353a188SXin LiBecause watch face apps do not have a default Activity in their project, you will need to set your
40*d353a188SXin LiConfigurations to "Do not launch Activity" for both the Wear and Application modules. If you are
41*d353a188SXin Liunsure how to do this, please review the "Run Starter project" section in the
42*d353a188SXin Li[Google Watch Face Code Lab][1].
43*d353a188SXin Li
44*d353a188SXin Li[1]: https://codelabs.developers.google.com/codelabs/watchface/index.html
45*d353a188SXin Li
46*d353a188SXin LiPre-requisites
47*d353a188SXin Li--------------
48*d353a188SXin Li
49*d353a188SXin Li- Android SDK 27
50*d353a188SXin Li- Android Build Tools v27.0.2
51*d353a188SXin Li- Android Support Repository
52*d353a188SXin Li
53*d353a188SXin LiScreenshots
54*d353a188SXin Li-------------
55*d353a188SXin Li
56*d353a188SXin Li<img src="screenshots/analog-face.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-all.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-1.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-2.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-face.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-phone-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-watch-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/interactive-face.png" height="400" alt="Screenshot"/> <img src="screenshots/tilt-face.png" height="400" alt="Screenshot"/>
57*d353a188SXin Li
58*d353a188SXin LiGetting Started
59*d353a188SXin Li---------------
60*d353a188SXin Li
61*d353a188SXin LiThis sample uses the Gradle build system. To build this project, use the
62*d353a188SXin Li"gradlew build" command or use "Import Project" in Android Studio.
63*d353a188SXin Li
64*d353a188SXin LiSupport
65*d353a188SXin Li-------
66*d353a188SXin Li
67*d353a188SXin Li- Google+ Community: https://plus.google.com/communities/105153134372062985968
68*d353a188SXin Li- Stack Overflow: http://stackoverflow.com/questions/tagged/android
69*d353a188SXin Li
70*d353a188SXin LiIf you've found an error in this sample, please file an issue:
71*d353a188SXin Lihttps://github.com/googlesamples/android-WatchFace
72*d353a188SXin Li
73*d353a188SXin LiPatches are encouraged, and may be submitted by forking this project and
74*d353a188SXin Lisubmitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
75*d353a188SXin Li
76*d353a188SXin LiLicense
77*d353a188SXin Li-------
78*d353a188SXin Li
79*d353a188SXin LiCopyright 2017 The Android Open Source Project, Inc.
80*d353a188SXin Li
81*d353a188SXin LiLicensed to the Apache Software Foundation (ASF) under one or more contributor
82*d353a188SXin Lilicense agreements.  See the NOTICE file distributed with this work for
83*d353a188SXin Liadditional information regarding copyright ownership.  The ASF licenses this
84*d353a188SXin Lifile to you under the Apache License, Version 2.0 (the "License"); you may not
85*d353a188SXin Liuse this file except in compliance with the License.  You may obtain a copy of
86*d353a188SXin Lithe License at
87*d353a188SXin Li
88*d353a188SXin Lihttp://www.apache.org/licenses/LICENSE-2.0
89*d353a188SXin Li
90*d353a188SXin LiUnless required by applicable law or agreed to in writing, software
91*d353a188SXin Lidistributed under the License is distributed on an "AS IS" BASIS, WITHOUT
92*d353a188SXin LiWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
93*d353a188SXin LiLicense for the specific language governing permissions and limitations under
94*d353a188SXin Lithe License.
95