Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make counter sample consistent across phone and watch #1991

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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