From 623ba53a6a7d952182bd595fe72bee8996dff07c Mon Sep 17 00:00:00 2001 From: Chiara Chiappini Date: Thu, 18 Jan 2024 16:16:45 +0000 Subject: [PATCH] Make counter sample consistent across phone and watch (#1991) --- datalayer/sample/phone/build.gradle.kts | 2 ++ .../sample/screens/counter/CounterScreen.kt | 18 ++++++++++++++---- .../phone/src/main/res/values/strings.xml | 3 ++- .../wear/src/main/res/values/strings.xml | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/datalayer/sample/phone/build.gradle.kts b/datalayer/sample/phone/build.gradle.kts index 320ddcc1c5..87e5fde489 100644 --- a/datalayer/sample/phone/build.gradle.kts +++ b/datalayer/sample/phone/build.gradle.kts @@ -115,6 +115,8 @@ dependencies { implementation(libs.androidx.lifecycle.runtime.compose) implementation(libs.androidx.lifecycle.service) implementation(libs.androidx.navigation.compose) + implementation(libs.compose.material.iconscore) + implementation(libs.compose.material.iconsext) coreLibraryDesugaring(libs.android.desugar) diff --git a/datalayer/sample/phone/src/main/java/com/google/android/horologist/datalayer/sample/screens/counter/CounterScreen.kt b/datalayer/sample/phone/src/main/java/com/google/android/horologist/datalayer/sample/screens/counter/CounterScreen.kt index 6017d40989..5a427f56c0 100644 --- a/datalayer/sample/phone/src/main/java/com/google/android/horologist/datalayer/sample/screens/counter/CounterScreen.kt +++ b/datalayer/sample/phone/src/main/java/com/google/android/horologist/datalayer/sample/screens/counter/CounterScreen.kt @@ -16,13 +16,14 @@ package com.google.android.horologist.datalayer.sample.screens.counter +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Add +import androidx.compose.material.icons.filled.PlusOne import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Icon @@ -81,10 +82,19 @@ fun CounterScreen( .padding(16.dp), ) { Text(text = stringResource(R.string.app_helper_counter_increase_explanation)) - Row(verticalAlignment = Alignment.CenterVertically) { - Text(text = "Counter: " + state.counter) + Row( + modifier = Modifier + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ) { + Text( + modifier = Modifier + .padding(16.dp), + text = stringResource(R.string.app_helper_counter_message, state.counter), + ) Button(onClick = onPlusClick) { - Icon(imageVector = Icons.Default.Add, contentDescription = "Plus 1") + Icon(imageVector = Icons.Default.PlusOne, contentDescription = "Plus 1") } } } diff --git a/datalayer/sample/phone/src/main/res/values/strings.xml b/datalayer/sample/phone/src/main/res/values/strings.xml index f146552274..652fe3aa35 100644 --- a/datalayer/sample/phone/src/main/res/values/strings.xml +++ b/datalayer/sample/phone/src/main/res/values/strings.xml @@ -72,7 +72,8 @@ Counter: %1$s Increase counter - Open the datalayer sample on your watch to observe how the counter number is incremented + Value: %1$s + Open the datalayer sample on your watch to observe how the counter number is incremented. This is a sample activity to demonstrate it being launched remotely from the watch. diff --git a/datalayer/sample/wear/src/main/res/values/strings.xml b/datalayer/sample/wear/src/main/res/values/strings.xml index 7e592fe1ba..b72bacf45a 100644 --- a/datalayer/sample/wear/src/main/res/values/strings.xml +++ b/datalayer/sample/wear/src/main/res/values/strings.xml @@ -30,7 +30,7 @@ Nodes actions - Value of the counter from Phone + Open the datalayer sample on your phone to observe how the counter number is incremented. Data Layer