diff --git a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/ArrivalViewTheme.kt b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/ArrivalViewTheme.kt index 40a9afbe..3d280d99 100644 --- a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/ArrivalViewTheme.kt +++ b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/ArrivalViewTheme.kt @@ -17,12 +17,8 @@ enum class ArrivalViewStyle { interface ArrivalViewTheme { /** The text style for the step distance (or distance to step). */ @get:Composable val style: ArrivalViewStyle - /** The color for the measurement/value. */ - @get:Composable val measurementColor: Color /** The text style for the measurement/value. */ @get:Composable val measurementTextStyle: TextStyle - /** The color for the secondary content (label caption). */ - @get:Composable val secondaryColor: Color /** The text style for the secondary content (label caption). */ @get:Composable val secondaryTextStyle: TextStyle /** The exit button icon color. */ @@ -37,17 +33,16 @@ object DefaultArrivalViewTheme : ArrivalViewTheme { override val style: ArrivalViewStyle @Composable get() = ArrivalViewStyle.SIMPLIFIED - override val measurementColor: Color - @Composable get() = MaterialTheme.colorScheme.onBackground - override val measurementTextStyle: TextStyle - @Composable get() = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.SemiBold) - - override val secondaryColor: Color - @Composable get() = MaterialTheme.colorScheme.secondary + @Composable + get() = + MaterialTheme.typography.titleLarge.copy( + color = MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.SemiBold) override val secondaryTextStyle: TextStyle - @Composable get() = MaterialTheme.typography.labelSmall + @Composable + get() = + MaterialTheme.typography.labelSmall.copy(color = MaterialTheme.colorScheme.onSurfaceVariant) override val exitIconColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary @@ -56,5 +51,5 @@ object DefaultArrivalViewTheme : ArrivalViewTheme { @Composable get() = MaterialTheme.colorScheme.secondary override val backgroundColor: Color - @Composable get() = MaterialTheme.colorScheme.background + @Composable get() = MaterialTheme.colorScheme.surface } diff --git a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/InstructionRowTheme.kt b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/InstructionRowTheme.kt index 85b42404..c9b04263 100644 --- a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/InstructionRowTheme.kt +++ b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/theme/InstructionRowTheme.kt @@ -13,19 +13,25 @@ interface InstructionRowTheme { @get:Composable val instructionTextStyle: TextStyle /** The color of the icon. */ @get:Composable val iconTintColor: Color + /** The background color for the view. */ + @get:Composable val backgroundColor: Color } /** Default theme using the material theme. */ object DefaultInstructionRowTheme : InstructionRowTheme { override val distanceTextStyle: TextStyle @Composable - get() = MaterialTheme.typography.titleLarge.merge(color = MaterialTheme.colorScheme.primary) + get() = MaterialTheme.typography.titleLarge.merge(color = MaterialTheme.colorScheme.onSurface) override val instructionTextStyle: TextStyle @Composable get() = - MaterialTheme.typography.headlineSmall.merge(color = MaterialTheme.colorScheme.secondary) + MaterialTheme.typography.headlineSmall.merge( + color = MaterialTheme.colorScheme.onSurfaceVariant) override val iconTintColor: Color - @Composable get() = MaterialTheme.colorScheme.primary + @Composable get() = MaterialTheme.colorScheme.onSurface + + override val backgroundColor: Color + @Composable get() = MaterialTheme.colorScheme.surface } diff --git a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/ArrivalView.kt b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/ArrivalView.kt index 6bf2c3d2..1815d117 100644 --- a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/ArrivalView.kt +++ b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/ArrivalView.kt @@ -83,13 +83,9 @@ fun ArrivalView( text = estimatedArrivalFormatter.format( progress.estimatedArrivalTime(fromDate, timeZone)), - style = theme.measurementTextStyle, - color = theme.measurementColor) + style = theme.measurementTextStyle) if (theme.style == ArrivalViewStyle.INFORMATIONAL) { - Text( - text = "Arrival", - style = theme.secondaryTextStyle, - color = theme.secondaryColor) + Text(text = "Arrival", style = theme.secondaryTextStyle) } } @@ -97,13 +93,9 @@ fun ArrivalView( modifier = Modifier.weight(1f), horizontalAlignment = Alignment.CenterHorizontally) { Text( text = durationFormatter.format(progress.durationRemaining), - style = theme.measurementTextStyle, - color = theme.measurementColor) + style = theme.measurementTextStyle) if (theme.style == ArrivalViewStyle.INFORMATIONAL) { - Text( - text = "Duration", - style = theme.secondaryTextStyle, - color = theme.secondaryColor) + Text(text = "Duration", style = theme.secondaryTextStyle) } } @@ -111,13 +103,9 @@ fun ArrivalView( modifier = Modifier.weight(1f), horizontalAlignment = Alignment.CenterHorizontally) { Text( text = distanceFormatter.format(progress.distanceRemaining), - style = theme.measurementTextStyle, - color = theme.measurementColor) + style = theme.measurementTextStyle) if (theme.style == ArrivalViewStyle.INFORMATIONAL) { - Text( - text = "Distance", - style = theme.secondaryTextStyle, - color = theme.secondaryColor) + Text(text = "Distance", style = theme.secondaryTextStyle) } } @@ -127,12 +115,13 @@ fun ArrivalView( onClick = { onTapExit() }, modifier = Modifier.size(50.dp), shape = CircleShape, - colors = ButtonDefaults.buttonColors(containerColor = theme.secondaryColor), + colors = + ButtonDefaults.buttonColors(containerColor = theme.exitButtonBackgroundColor), contentPadding = PaddingValues(0.dp)) { Icon( imageVector = Icons.Filled.Close, contentDescription = "Close", - tint = Color.White) + tint = theme.exitIconColor) } } } @@ -164,18 +153,17 @@ fun ArrivalViewInformationalPreview() { override val style: ArrivalViewStyle @Composable get() = ArrivalViewStyle.INFORMATIONAL - override val measurementColor: Color - @Composable get() = MaterialTheme.colorScheme.onBackground - override val measurementTextStyle: TextStyle @Composable - get() = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.SemiBold) - - override val secondaryColor: Color - @Composable get() = MaterialTheme.colorScheme.secondary + get() = + MaterialTheme.typography.titleLarge.copy( + color = MaterialTheme.colorScheme.onBackground, fontWeight = FontWeight.SemiBold) override val secondaryTextStyle: TextStyle - @Composable get() = MaterialTheme.typography.labelSmall + @Composable + get() = + MaterialTheme.typography.labelSmall.copy( + color = MaterialTheme.colorScheme.onBackground) override val exitIconColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary diff --git a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/InstructionsView.kt b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/InstructionsView.kt index 93be082a..7aadadba 100644 --- a/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/InstructionsView.kt +++ b/android/composeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/InstructionsView.kt @@ -44,7 +44,7 @@ fun InstructionsView( modifier = Modifier.fillMaxWidth() .shadow(elevation = 5.dp, RoundedCornerShape(10.dp)) - .background(MaterialTheme.colorScheme.background, RoundedCornerShape(10.dp)) + .background(theme.backgroundColor, RoundedCornerShape(10.dp)) .padding(8.dp)) { ManeuverInstructionView( text = instructions.primaryContent.text, diff --git a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_ArrivalViewTest_testArrivalViewInformationalStyle.png b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_ArrivalViewTest_testArrivalViewInformationalStyle.png index c11fcbcc..9aee5c36 100644 Binary files a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_ArrivalViewTest_testArrivalViewInformationalStyle.png and b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_ArrivalViewTest_testArrivalViewInformationalStyle.png differ diff --git a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_InstructionViewTest_testInstructionView.png b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_InstructionViewTest_testInstructionView.png index c4e9e287..50888910 100644 Binary files a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_InstructionViewTest_testInstructionView.png and b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_InstructionViewTest_testInstructionView.png differ diff --git a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_RTLInstructionViewTests_testRTLInstructionView.png b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_RTLInstructionViewTests_testRTLInstructionView.png index 3c857946..e65a4d86 100644 Binary files a/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_RTLInstructionViewTests_testRTLInstructionView.png and b/android/composeui/src/test/snapshots/images/com.stadiamaps.ferrostar.views_RTLInstructionViewTests_testRTLInstructionView.png differ