-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1078 from android/complications
Renames to Complications
- Loading branch information
Showing
48 changed files
with
2,602 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2019 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# GOOGLE SAMPLE PACKAGING DATA | ||
# | ||
# This file is used by Google as part of our samples packaging process. | ||
# End users may safely ignore this file. It has no relevance to other systems. | ||
--- | ||
status: PUBLISHED | ||
technologies: [Android] | ||
categories: [Wearable] | ||
languages: [Java] | ||
solutions: [Mobile] | ||
github: android/wear-os | ||
level: INTERMEDIATE | ||
icon: screenshots/icon-web.png | ||
apiRefs: | ||
- android:android.support.wearable.complications.ComplicationData | ||
- android:android.support.wearable.complications.ComplicationManager | ||
- android:android.support.wearable.complications.ComplicationProviderService | ||
- android:android.support.wearable.complications.ComplicationText | ||
- android:android.support.wearable.complications.ProviderUpdateRequester | ||
license: apache2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
Android Complications Sample | ||
============================ | ||
|
||
Complication Test Suite is a set of complication data sources that provide dummy data and it can be | ||
used to test how different types of complications render on a watch face. | ||
|
||
Introduction | ||
------------ | ||
|
||
Steps for trying out the sample: | ||
* Compile and install the wearable app onto your Wear device or emulator (for Wear scenario). | ||
|
||
* This sample does not have a main Activity (just Services that provide the complication data). | ||
Therefore, you may see an error next to the 'Run' button. To fix, click on the | ||
"Wearable" dropdown next to the 'Run' button and select 'Edit Configurations'. Under the | ||
'Launch Options', change the 'Launch' field from 'Default APK' to 'Nothing' and save. | ||
|
||
This sample provides dummy data for testing the complications UI in your watch face. After | ||
selecting a type from your watch face configuration Activity, you can tap on the complications to | ||
see more options. | ||
|
||
The Wear app demonstrates the use of [ComplicationData][1], [ComplicationDataSourceService][2], and [ComplicationText][3]. | ||
|
||
[1]: https://developer.android.com/reference/kotlin/androidx/wear/complications/data/ComplicationData | ||
[2]: https://developer.android.com/reference/kotlin/androidx/wear/complications/datasource/ComplicationDataSourceService | ||
[3]: https://developer.android.com/reference/kotlin/androidx/wear/complications/data/ComplicationText | ||
|
||
Pre-requisites | ||
-------------- | ||
|
||
- Android SDK 30 | ||
|
||
Screenshots | ||
------------- | ||
|
||
<img src="screenshots/wear-1.png" height="400" alt="Screenshot"/> <img src="screenshots/wear-2.png" height="400" alt="Screenshot"/> | ||
|
||
Getting Started | ||
--------------- | ||
|
||
This sample uses the Gradle build system. To build this project, use the | ||
"gradlew build" command or use "Import Project" in Android Studio. | ||
|
||
Support | ||
------- | ||
|
||
- Stack Overflow: https://stackoverflow.com/questions/tagged/wear-os | ||
|
||
If you've found an error in this sample, please file an issue: | ||
https://github.com/android/wear-os-samples/issues | ||
|
||
Patches are encouraged, and may be submitted by forking this project and | ||
submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2021 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'org.jetbrains.kotlin.plugin.parcelize' | ||
} | ||
|
||
android { | ||
compileSdk 34 | ||
|
||
namespace "com.example.android.wearable.wear.complications" | ||
|
||
defaultConfig { | ||
versionCode 1 | ||
versionName "1.0" | ||
minSdk 26 | ||
targetSdk 33 | ||
} | ||
|
||
lintOptions { | ||
warningsAsErrors false | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
shrinkResources true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_17 | ||
targetCompatibility JavaVersion.VERSION_17 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.majorVersion | ||
} | ||
|
||
buildFeatures { | ||
viewBinding true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation libs.kotlinx.coroutines.android | ||
implementation libs.androidx.core.ktx | ||
implementation libs.androidx.datastore.preferences | ||
implementation libs.androidx.wear.watchface.complications.data.source.ktx | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2021 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.example.android.wearable.wear.complications" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<uses-feature android:name="android.hardware.type.watch" /> | ||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="AllowBackup"> | ||
|
||
<meta-data | ||
android:name="com.google.android.wearable.standalone" | ||
android:value="true" /> | ||
<uses-library | ||
android:name="com.google.android.wearable" | ||
android:required="false" /> | ||
|
||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.NoDataDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_not_interested_vd_theme_24" | ||
android:label="@string/no_data_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="SHORT_TEXT,LONG_TEXT,SMALL_IMAGE,ICON,RANGED_VALUE,LARGE_IMAGE" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.ShortTextDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_title_vd_theme_24" | ||
android:label="@string/short_text_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="SHORT_TEXT" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.SmallImageDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_image_vd_theme_24" | ||
android:label="@string/small_image_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="SMALL_IMAGE" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.LargeImageDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_landscape_vd_theme_24" | ||
android:label="@string/large_image_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="LARGE_IMAGE" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.IconDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_face_vd_theme_24" | ||
android:label="@string/icon_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="ICON" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.LongTextDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_short_text_vd_theme_24" | ||
android:label="@string/long_text_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="LONG_TEXT" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.RangedValueDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_data_usage_vd_theme_24" | ||
android:label="@string/ranged_value_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="RANGED_VALUE" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.GoalProgressDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_data_usage_vd_theme_24" | ||
android:label="@string/goal_progress_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="GOAL_PROGRESS" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<service | ||
android:name="com.example.android.wearable.wear.complications.WeightedElementsDataSourceService" | ||
android:exported="true" | ||
android:icon="@drawable/ic_data_usage_vd_theme_24" | ||
android:label="@string/weighted_elements" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="WEIGHTED_ELEMENTS" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
|
||
<receiver android:name="com.example.android.wearable.wear.complications.ComplicationToggleReceiver" /> | ||
</application> | ||
</manifest> |
Oops, something went wrong.