Skip to content

Commit

Permalink
Added text for empty states
Browse files Browse the repository at this point in the history
  • Loading branch information
diareuse committed Oct 15, 2023
1 parent 92c6d36 commit 29636db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private fun BookingsScreen(
.focusable(),
state = state,
verticalArrangement = Arrangement.spacedBy(8.dp),
autoCentering = AutoCenteringParams(itemOffset = 1),
autoCentering = AutoCenteringParams(itemIndex = 1, itemOffset = 1),
contentPadding = PaddingValues(horizontal = 16.dp)
) {
item { Text(stringResource(R.string.bookings_title), style = Theme.textStyle.title) }
Expand All @@ -110,6 +110,14 @@ private fun BookingsScreen(
item {
EmptyComponent(Modifier.fillParentMaxWidth())
}
item {
Text(
modifier = Modifier.fillParentMaxWidth(),
text = stringResource(R.string.bookings_active_empty),
style = Theme.textStyle.caption,
textAlign = TextAlign.Center
)
}
}
item {
Text(
Expand Down Expand Up @@ -139,6 +147,14 @@ private fun BookingsScreen(
item {
EmptyComponent(Modifier.fillParentMaxWidth())
}
item {
Text(
modifier = Modifier.fillParentMaxWidth(),
text = stringResource(R.string.bookings_expired_empty),
style = Theme.textStyle.caption,
textAlign = TextAlign.Center
)
}
}
}
LaunchedEffect(Unit) {
Expand All @@ -154,4 +170,11 @@ private fun Preview(
@PreviewParameter(TicketViewPreviews::class, 1) previews: List<TicketView>
) = PreviewWearLayout(padding = PaddingValues()) {
BookingsScreen(Loadable.success(previews))
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND, showSystemUi = true, showBackground = true)
@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showSystemUi = true, showBackground = true)
@Composable
private fun PreviewEmpty() = PreviewWearLayout(padding = PaddingValues()) {
BookingsScreen(Loadable.success(emptyList()))
}
4 changes: 3 additions & 1 deletion app-wear/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<resources>
<string name="app_name">Movie Metropolis</string>
<string name="bookings_title">Tvoje lístky</string>
<string name="bookings_expired_title">Vypršené</string>
<string name="bookings_expired_title">Expirované</string>
<string name="bookings_active_empty">Lístky se zobrazí tady, když budou aktivní. V mobilní aplikaci jdi do sekce s lístky pro obnovení dat v hodinkách.</string>
<string name="bookings_expired_empty">Expirované lístky se tu zobrazí. V mobilní aplikaci jdi do sekce s lístky pro obnovení dat v hodinkách.</string>
</resources>
2 changes: 2 additions & 0 deletions app-wear/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<string name="app_name">Movie Metropolis</string>
<string name="bookings_title">Your tickets</string>
<string name="bookings_expired_title">Expired</string>
<string name="bookings_active_empty">Tickets will be displayed here after a purchase whilst they are active. Visit Tickets in your mobile app to push new data to your watch.</string>
<string name="bookings_expired_empty">Expired tickets will be displayed here. Visit Tickets in your mobile app to push new data to your watch.</string>
</resources>

0 comments on commit 29636db

Please sign in to comment.