Skip to content

Commit

Permalink
Merge branch 'main' of github.com:android/wear-os-samples into target-34
Browse files Browse the repository at this point in the history
  • Loading branch information
shumelchyk committed Aug 13, 2024
2 parents 246452e + c549734 commit 726d0f3
Show file tree
Hide file tree
Showing 30 changed files with 398 additions and 307 deletions.
2 changes: 1 addition & 1 deletion Complications/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-wear-watchface = "1.2.1"

org-jetbrains-kotlin = "1.9.24"
Expand Down
4 changes: 2 additions & 2 deletions ComposeStarter/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-activity = "1.9.1"
androidx-compose-bom = "2024.06.00"
androidx-wear-compose = "1.3.1"
Expand All @@ -9,7 +9,7 @@ horologist = "0.5.28"
ktlint = "0.50.0"
org-jetbrains-kotlin = "1.9.24"
robolectric = "4.13"
roborazzi = "1.25.0"
roborazzi = "1.26.0"
ui-test-junit4 = "1.6.8"
ui-test-manifest = "1.6.8"

Expand Down
4 changes: 2 additions & 2 deletions DataLayer/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-activity = "1.9.1"
androidx-compose-bom = "2024.06.00"
# do not bump to 2.8.0 until bumping to beta version of Compose
Expand All @@ -12,7 +12,7 @@ org-jetbrains-kotlinx = "1.8.1"
horologist = "0.5.28"
compose-ui-tooling = "1.3.1"
robolectric = "4.13"
roborazzi = "1.25.0"
roborazzi = "1.26.0"
ui-test-junit4 = "1.6.8"
ui-test-manifest = "1.6.8"

Expand Down
2 changes: 1 addition & 1 deletion WatchFaceFormat/Complications/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.5.1" apply false
id("com.android.application") version "8.5.2" apply false
}
2 changes: 1 addition & 1 deletion WatchFaceFormat/Flavors/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.5.1" apply false
id("com.android.application") version "8.5.2" apply false
}
2 changes: 1 addition & 1 deletion WatchFaceFormat/SimpleAnalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.5.1" apply false
id("com.android.application") version "8.5.2" apply false
}
2 changes: 1 addition & 1 deletion WatchFaceFormat/SimpleDigital/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.5.1" apply false
id("com.android.application") version "8.5.2" apply false
}
2 changes: 1 addition & 1 deletion WatchFaceFormat/Weather/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.5.1" apply false
id("com.android.application") version "8.5.2" apply false
}
6 changes: 3 additions & 3 deletions WatchFaceKotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-activity = "1.9.1"
androidx-lifecycle = "2.8.4"
androidx-test = "1.4.0"
Expand All @@ -12,11 +12,11 @@ org-jetbrains-kotlin = "1.9.24"
org-jetbrains-kotlinx = "1.8.1"

[libraries]
android-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.1"
android-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.2"
android-material = "com.google.android.material:material:1.12.0"
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" }
androidx-core-ktx = "androidx.core:core-ktx:1.13.1"
androidx-databinding-viewbinding = "androidx.databinding:viewbinding:8.5.1"
androidx-databinding-viewbinding = "androidx.databinding:viewbinding:8.5.2"
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
androidx-wear = "androidx.wear:wear:1.3.0"
Expand Down
12 changes: 6 additions & 6 deletions WearOAuth/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-compose-bom = "2024.06.00"
androidx-activity = "1.9.1"
androidx-lifecycle = "2.8.4"
androidx-test = "1.5.2"
androidx-wear-compose = "1.4.0-beta03"
compose = "1.7.0-beta06"
compose = "1.7.0-beta07"
compose-compiler = "1.5.14"
org-jetbrains-kotlin = "1.9.24"
org-jetbrains-kotlinx = "1.8.1"
ktlint = "0.50.0"
compose-material3 = "1.0.0-alpha23"
horologist = "0.6.12"
robolectric = "4.13"
roborazzi = "1.25.0"
roborazzi = "1.26.0"
ui-test-junit4 = "1.6.8"

[libraries]
android-build-gradle = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" }
android-desugarjdklibs = "com.android.tools:desugar_jdk_libs:2.0.4"
android-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.1"
android-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.2"
android-material = "com.google.android.material:material:1.12.0"
android-tools-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.1"
android-tools-lint-gradle = "com.android.tools.lint:lint-gradle:31.5.2"
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" }
androidx-appcompat = "androidx.appcompat:appcompat:1.7.0"
Expand All @@ -30,7 +30,7 @@ androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", versi
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
androidx-constraintlayout-compose = "androidx.constraintlayout:constraintlayout-compose:1.0.1"
androidx-core-ktx = "androidx.core:core-ktx:1.13.1"
androidx-databinding-viewbinding = "androidx.databinding:viewbinding:8.5.1"
androidx-databinding-viewbinding = "androidx.databinding:viewbinding:8.5.2"
androidx-datastore-preferences = "androidx.datastore:datastore-preferences:1.1.1"
androidx-fragment-ktx = "androidx.fragment:fragment-ktx:1.8.2"
androidx-lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidx-lifecycle" }
Expand Down
4 changes: 2 additions & 2 deletions WearSpeakerSample/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.5.1"
android-gradle-plugin = "8.5.2"
androidx-activity = "1.9.1"
androidx-compose-bom = "2024.06.00"
androidx-lifecycle = "2.7.0"
Expand All @@ -10,7 +10,7 @@ compose-ui-tooling = "1.3.1"
ktlint = "0.50.0"
org-jetbrains-kotlin = "1.9.24"
robolectric = "4.13"
roborazzi = "1.25.0"
roborazzi = "1.26.0"
ui-test-junit4 = "1.6.8"
ui-test-manifest = "1.6.8"
horologist = "0.5.28"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ object Alarm {
@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.SMALL_ROUND, fontScale = 1.24f)
@Preview(device = WearDevices.LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND, fontScale = 1.24f)
fun AlarmPreview(context: Context) = TilePreviewData {
@Preview(device = WearDevices.LARGE_ROUND, fontScale = 0.94f)
internal fun alarmPreview(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
Alarm.layout(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ object Calendar {
@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.SMALL_ROUND, fontScale = 1.24f)
@Preview(device = WearDevices.LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND, fontScale = 1.24f)
fun CalendarPreview(context: Context) = TilePreviewData {
@Preview(device = WearDevices.LARGE_ROUND, fontScale = 0.94f)
internal fun calendarPreview(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
Calendar.layout(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ import androidx.wear.protolayout.material.ProgressIndicatorColors
import androidx.wear.protolayout.material.Text
import androidx.wear.protolayout.material.Typography
import androidx.wear.protolayout.material.layouts.EdgeContentLayout
import androidx.wear.tiles.tooling.preview.Preview
import androidx.wear.tiles.tooling.preview.TilePreviewData
import androidx.wear.tiles.tooling.preview.TilePreviewHelper.singleTimelineEntryTileBuilder
import androidx.wear.tooling.preview.devices.WearDevices

object Goal {
fun layout(context: Context, deviceParameters: DeviceParameters, steps: Int, goal: Int) =
EdgeContentLayout.Builder(deviceParameters)
.setResponsiveContentInsetEnabled(true)
.setEdgeContent(
CircularProgressIndicator.Builder()
.setProgress(steps.toFloat() / goal)
Expand Down Expand Up @@ -60,3 +65,15 @@ private fun blueOnTranslucentWhite() = ProgressIndicatorColors(
/* trackColor = */
ColorBuilders.argb(GoldenTilesColors.White10Pc)
)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.SMALL_ROUND, fontScale = 1.24f)
@Preview(device = WearDevices.LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND, fontScale = 0.94f)
internal fun goalPreview(context: Context) = TilePreviewData {
singleTimelineEntryTileBuilder(
Goal.layout(
context, it.deviceConfiguration, steps = 5168, goal = 8000
)
).build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,90 +19,30 @@ import android.content.Context
import androidx.wear.protolayout.ResourceBuilders
import androidx.wear.tiles.RequestBuilders
import androidx.wear.tiles.tooling.preview.Preview
import androidx.wear.tiles.tooling.preview.TilePreviewData
import androidx.wear.tiles.tooling.preview.TilePreviewHelper.singleTimelineEntryTileBuilder
import androidx.wear.tooling.preview.devices.WearDevices
import com.example.wear.tiles.R
import com.example.wear.tiles.tools.emptyClickable
import com.google.android.horologist.tiles.images.drawableResToImageResource

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun Goal(context: Context) = TilePreviewData {
singleTimelineEntryTileBuilder(
Goal.layout(
context, it.deviceConfiguration, steps = 5168, goal = 8000
)
).build()
}
private fun goal(context: Context) = goalPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun WorkoutButtons(context: Context) = TilePreviewData(onTileResourceRequest = resources {
addIdToImageMapping(
Workout.BUTTON_1_ICON_ID, drawableResToImageResource(R.drawable.ic_run_24)
)
addIdToImageMapping(
Workout.BUTTON_2_ICON_ID, drawableResToImageResource(R.drawable.ic_yoga_24)
)
addIdToImageMapping(
Workout.BUTTON_3_ICON_ID, drawableResToImageResource(R.drawable.ic_cycling_24)
)
}) {
singleTimelineEntryTileBuilder(
Workout.buttonsLayout(
context,
it.deviceConfiguration,
weekSummary = "1 run this week",
button1Clickable = emptyClickable,
button2Clickable = emptyClickable,
button3Clickable = emptyClickable,
chipClickable = emptyClickable
)
).build()
}
private fun workoutButtons(context: Context) = workoutButtonsPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun WorkoutLargeChip(context: Context) = TilePreviewData {
singleTimelineEntryTileBuilder(
Workout.largeChipLayout(
context,
it.deviceConfiguration,
clickable = emptyClickable,
lastWorkoutSummary = "Last session 45m"
)
).build()
}
private fun workoutLargeChip(context: Context) = workoutLargeChipPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun Run(context: Context) = TilePreviewData {
singleTimelineEntryTileBuilder(
Run.layout(
context,
it.deviceConfiguration,
lastRunText = "2 days ago",
startRunClickable = emptyClickable,
moreChipClickable = emptyClickable
)
).build()
}
private fun run(context: Context) = runPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun Ski(context: Context) = TilePreviewData {
singleTimelineEntryTileBuilder(
Ski.layout(
context,
stat1 = Ski.Stat("Max Spd", "46.5", "mph"),
stat2 = Ski.Stat("Distance", "21.8", "mile")
)
).build()
}
private fun ski(context: Context) = skiPreview(context)

//@Preview
fun SleepTracker(context: Context) {
fun sleepTracker(context: Context) {
// TODO: This tile doesn't use standard components; we can achieve it by drawing on a Canvas (Compose's DrawScope) then converting it to a bitmap using Horologist
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,16 @@ import com.google.android.horologist.tiles.images.drawableResToImageResource
*/
@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun HeartRateSimple(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
HeartRate.simpleLayout(
context,
it.deviceConfiguration,
heartRateBpm = 86,
clickable = emptyClickable
)
).build()
}
private fun heartRateSimple(context: Context) = heartRateSimplePreview(context)

//@Preview
fun HeartRateGraph(context: Context) {
private fun heartRateGraph(context: Context) {
TODO()
}

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun MeditationChips(context: Context) = TilePreviewData(resources {
private fun meditationChips(context: Context) = TilePreviewData(resources {
addIdToImageMapping(
Meditation.CHIP_1_ICON_ID,
drawableResToImageResource(R.drawable.ic_breathe_24)
Expand Down Expand Up @@ -79,48 +70,12 @@ fun MeditationChips(context: Context) = TilePreviewData(resources {

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun MeditationButtons(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
Meditation.buttonsLayout(
context,
it.deviceConfiguration,
timer1 = Meditation.Timer(minutes = 5, clickable = emptyClickable),
timer2 = Meditation.Timer(minutes = 10, clickable = emptyClickable),
timer3 = Meditation.Timer(minutes = 15, clickable = emptyClickable),
clickable = emptyClickable
)
).build()
}
private fun meditationButtons(context: Context) = meditationButtonsPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun Timer(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
Timer.layout(
context,
it.deviceConfiguration,
timer1 = Timer.Timer(minutes = "05", clickable = emptyClickable),
timer2 = Timer.Timer(minutes = "10", clickable = emptyClickable),
timer3 = Timer.Timer(minutes = "15", clickable = emptyClickable),
timer4 = Timer.Timer(minutes = "20", clickable = emptyClickable),
timer5 = Timer.Timer(minutes = "30", clickable = emptyClickable),
timer6 = Timer.Timer(minutes = "45", clickable = emptyClickable),
clickable = emptyClickable
)
).build()
}
private fun timer(context: Context) = timerPreview(context)

@Preview(device = WearDevices.SMALL_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
fun Alarm(context: Context) = TilePreviewData {
TilePreviewHelper.singleTimelineEntryTileBuilder(
Alarm.layout(
context,
it.deviceConfiguration,
timeUntilAlarm = "Less than 1 min",
alarmTime = "14:58",
alarmDays = "Mon, Tue, Wed, Thu, Fri,Sat",
clickable = emptyClickable
)
).build()
}
private fun alarm(context: Context) = alarmPreview(context)
Loading

0 comments on commit 726d0f3

Please sign in to comment.