diff --git a/core/src/main/java/com/advice/core/utils/TimeUtil.kt b/core/src/main/java/com/advice/core/utils/TimeUtil.kt index f0832e42..2f230f47 100644 --- a/core/src/main/java/com/advice/core/utils/TimeUtil.kt +++ b/core/src/main/java/com/advice/core/utils/TimeUtil.kt @@ -71,7 +71,7 @@ object TimeUtil { val pattern = if (is24HourFormat) { "HH:mm" } else { - "h:mm a" + "hh:mm" } val timeFormat = DateTimeFormatter.ofPattern(pattern) diff --git a/ui/src/main/java/com/advice/ui/components/EventRowView.kt b/ui/src/main/java/com/advice/ui/components/EventRowView.kt index 338c05be..04870d6b 100644 --- a/ui/src/main/java/com/advice/ui/components/EventRowView.kt +++ b/ui/src/main/java/com/advice/ui/components/EventRowView.kt @@ -86,11 +86,7 @@ fun EventRowView( .fillMaxWidth() ) { CategoryDash(tags) - Text( - time.replace(" ", "\n"), - textAlign = TextAlign.Center, - modifier = Modifier.width(85.dp) - ) + Time(time) Column( Modifier .weight(1f) @@ -121,6 +117,30 @@ private fun CategoryDash(tags: List) { } } +@Composable +private fun Time(time: String) { + val parts = time.split(" - ") + val begin = parts[0] + val end = parts.getOrNull(1) + + Column( + Modifier.width(85.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text( + begin, + textAlign = TextAlign.Center + ) + if (end != null) { + Text( + end, + textAlign = TextAlign.Center, + style = MaterialTheme.typography.labelSmall + ) + } + } +} + @Composable @OptIn(ExperimentalLayoutApi::class) private fun Categories(tags: List) { @@ -168,7 +188,7 @@ private fun EventRowViewPreview() { Column { EventRowView( title = "Compelled Decryption", - time = "5:30\nAM", + time = "05:30 - 07:00", location = "Track 1", tags = listOf( createTag(label = "Introduction", color = "#EEAAFF"), @@ -179,7 +199,7 @@ private fun EventRowViewPreview() { ) EventRowView( title = "Compelled Decryption", - time = "6:00\nAM", + time = "06:00 - 08:00", location = "Track 1", tags = listOf( createTag(label = "Talk", color = "#FF61EEAA"), @@ -189,6 +209,17 @@ private fun EventRowViewPreview() { onEventPressed = {}, onBookmark = {}, ) + EventRowView( + title = "Compelled Decryption", + time = "07:00", + location = "Track 1", + tags = listOf( + createTag(label = "Introduction", color = "#EEAAFF"), + ), + isBookmarked = false, + onEventPressed = {}, + onBookmark = {}, + ) } } } diff --git a/ui/src/main/java/com/advice/ui/screens/ScheduleScreen.kt b/ui/src/main/java/com/advice/ui/screens/ScheduleScreen.kt index c16d2a07..01b753c9 100644 --- a/ui/src/main/java/com/advice/ui/screens/ScheduleScreen.kt +++ b/ui/src/main/java/com/advice/ui/screens/ScheduleScreen.kt @@ -212,7 +212,7 @@ private fun ScheduleScreenContent( item(key = it.id) { EventRowView( title = it.title, - time = TimeUtil.getTimeStamp(context, it), + time = TimeUtil.getEventTimeStamp(context, it), location = it.location.name, tags = it.types, isBookmarked = it.isBookmarked,