Skip to content

Commit

Permalink
Make counter sample consistent across phone and watch (#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
kul3r4 authored Jan 18, 2024
1 parent 18660dc commit 623ba53
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions datalayer/sample/phone/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion datalayer/sample/phone/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
<!-- Counter screen -->
<string name="app_helper_counter_label">Counter: %1$s</string>
<string name="app_helper_counter_increase_btn_content_description">Increase counter</string>
<string name="app_helper_counter_increase_explanation">Open the datalayer sample on your watch to observe how the counter number is incremented</string>
<string name="app_helper_counter_message">Value: %1$s </string>
<string name="app_helper_counter_increase_explanation">Open the datalayer sample on your watch to observe how the counter number is incremented.</string>

<!-- Start Remote Sample Activity screen -->
<string name="app_helper_start_remote_activity_message">This is a sample activity to demonstrate it being launched remotely from the watch.</string>
Expand Down
2 changes: 1 addition & 1 deletion datalayer/sample/wear/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string name="main_menu_apphelpers_nodes_actions_item">Nodes actions</string>

<!-- Counter screen -->
<string name="server_counter_message">Value of the counter from Phone</string>
<string name="server_counter_message">Open the datalayer sample on your phone to observe how the counter number is incremented.</string>

<!-- Data Layer screen -->
<string name="data_layer_title">Data Layer</string>
Expand Down

0 comments on commit 623ba53

Please sign in to comment.