Skip to content

Commit

Permalink
Update tiles sample for 1.1.0 (#497)
Browse files Browse the repository at this point in the history
* Update tiles sample for 1.1.0

* Replace parseColor with valueOf

* Add comment explaining why we don't check resourceIds for avatars

* Expand docs on why refreshData would be less necessary in a real example
  • Loading branch information
ataulm authored Aug 5, 2022
1 parent f6062df commit d2fdcac
Show file tree
Hide file tree
Showing 63 changed files with 574 additions and 792 deletions.
35 changes: 18 additions & 17 deletions WearTilesKotlin/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
Wear Tiles Sample
===============================
Demonstrates tiles using the [Wear Tiles AndroidX library](https://developer.android.com/jetpack/androidx/releases/wear-tiles).
=================

Introduction
------------
<img src="app/src/main/res/drawable/tile_messaging.png" height="400" alt="Screenshot"/>

[Tiles](https://d.android.com/training/articles/wear-tiles) provide users with swipeable access
to the things they need to know and get done right from their wrist. They are fast to access and
convenient, designed to provide users with what they need in the moment, which gives users control
over what information and actions they want to see.
[Tiles](https://d.android.com/training/wearables/tiles) provide easy access to the information and
actions users need in order to get things done. With a simple swipe from the watch face, a user can
find out the latest forecast or start a timer.

This repository contains a set of sample implementations of Tiles, demonstrating various use cases.
Each Tile extends TileProviderService and implements onTileRequest and onResourcesRequest.
This repository contains a sample tile built using the [Tiles Material Components](https://developer.android.com/reference/androidx/wear/tiles/material/package-summary)
library (for UI) and [Horologist Tiles](https://github.com/google/horologist#-tiles) (preview
utilities and Kotlin-friendly wrappers). It also showcases most of the Golden Tile layouts from the
[Tiles Design Kit](https://developer.android.com/training/wearables/design/tiles-design-system#tile-templates).

Screenshots
-------------
Get Started
-----------

<img src="app/src/main/res/drawable/tile_goals.png" height="400" alt="Screenshot Goals Tile"/> <img src="app/src/main/res/drawable/tile_media.png" height="400" alt="Screenshot"/> <img src="app/src/main/res/drawable/tile_messaging.png" height="400" alt="Screenshot"/>
Build the project from the command line using `./gradlew build` or import it into Android Studio to
benefit from the IDE shortcuts like direct surface launching which lets you launch the Messaging
tile directly to a device or emulator in just one click.

Getting Started
---------------
Layout samples from the Tiles Design Kit can be found in `GoldenTilesPreviewsRow[N].kt`. Open the
file in "Split" or "Design" mode to view the previews without a device or emulator.

This sample uses the Gradle build system. To build this project, use the "gradlew build" command or
use "Import Project" in Android Studio.
For the sample, start with `MessagingTileService.kt`; the layout (with IDE preview) can be found in
`MessagingTileLayout.kt`.

Support
-------
Expand Down
28 changes: 13 additions & 15 deletions WearTilesKotlin/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 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
~
~ 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.
-->
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 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"
package="com.example.wear.tiles">

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import com.example.wear.tiles.R
import com.example.wear.tiles.emptyClickable
import com.example.wear.tiles.tools.WearLargeRoundDevicePreview
import com.example.wear.tiles.tools.WearSmallRoundDevicePreview
import com.example.wear.tiles.tools.emptyClickable
import com.google.android.horologist.compose.tools.LayoutRootPreview
import com.google.android.horologist.compose.tools.buildDeviceParameters
import com.google.android.horologist.tiles.images.drawableResToImageResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import com.example.wear.tiles.R
import com.example.wear.tiles.emptyClickable
import com.example.wear.tiles.tools.WearLargeRoundDevicePreview
import com.example.wear.tiles.tools.WearSmallRoundDevicePreview
import com.example.wear.tiles.tools.emptyClickable
import com.google.android.horologist.compose.tools.LayoutRootPreview
import com.google.android.horologist.compose.tools.buildDeviceParameters
import com.google.android.horologist.tiles.images.drawableResToImageResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import com.example.wear.tiles.R
import com.example.wear.tiles.emptyClickable
import com.example.wear.tiles.tools.WearLargeRoundDevicePreview
import com.example.wear.tiles.tools.WearSmallRoundDevicePreview
import com.example.wear.tiles.tools.emptyClickable
import com.google.android.horologist.compose.tools.LayoutRootPreview
import com.google.android.horologist.compose.tools.buildDeviceParameters
import com.google.android.horologist.tiles.images.drawableResToImageResource
Expand Down

This file was deleted.

19 changes: 0 additions & 19 deletions WearTilesKotlin/app/src/debug/res/layout/activity_tile_preview.xml

This file was deleted.

33 changes: 15 additions & 18 deletions WearTilesKotlin/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 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
~
~ 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.
-->
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 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"
package="com.example.wear.tiles">

Expand All @@ -21,7 +19,6 @@
<uses-feature android:name="android.hardware.type.watch" />

<application
android:name=".TilesApplication"
android:allowBackup="false"
android:label="@string/app_name"
android:supportsRtl="true"
Expand All @@ -34,8 +31,8 @@
android:name="com.example.wear.tiles.messaging.MessagingTileService"
android:exported="true"
android:label="@string/tile_messaging_label"
android:description="@string/tile_description"
android:icon="@drawable/ic_person"
android:description="@string/tile_messaging_description"
android:icon="@drawable/ic_message_24"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
Expand Down
Loading

0 comments on commit d2fdcac

Please sign in to comment.