From 3235dd5c11643b35443203fcfea343ea72739871 Mon Sep 17 00:00:00 2001 From: Karan Sharma <55722391+ksharma-xyz@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:29:34 +1100 Subject: [PATCH] [TEMP] - UX braintorming with Adi --- .../trip/planner/ui/components/JourneyCard.kt | 23 +++++++++------- .../trip/planner/ui/components/LegView.kt | 26 ++++++++----------- .../ui/src/main/res/values/strings.xml | 4 +-- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt index f90771d7..4f5aa866 100644 --- a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt +++ b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row @@ -100,12 +99,6 @@ fun JourneyCard( Modifier }, ) - .clickable( - role = Role.Button, - onClick = onClick, - interactionSource = remember { MutableInteractionSource() }, - indication = null, - ) .padding( vertical = 8.dp, horizontal = if (cardState == JourneyCardState.DEFAULT) 12.dp else 0.dp, @@ -121,7 +114,12 @@ fun JourneyCard( themeColor = themeColor, transportModeList = transportModeList, platformNumber = platformNumber, - modifier = Modifier, + modifier = Modifier.clickable( + role = Role.Button, + onClick = onClick, + interactionSource = remember { MutableInteractionSource() }, + indication = null, + ), ) else -> JourneyCardContent( @@ -132,7 +130,12 @@ fun JourneyCard( iconSize = iconSize, totalTravelTime = totalTravelTime, legList = legList, - modifier = Modifier, + modifier = Modifier.clickable( + role = Role.Button, + onClick = onClick, + interactionSource = remember { MutableInteractionSource() }, + indication = null, + ), ) } } @@ -298,7 +301,7 @@ fun JourneyCardContent( @OptIn(ExperimentalLayoutApi::class) @Composable -fun ColumnScope.DefaultJourneyCardContent( +fun DefaultJourneyCardContent( timeToDeparture: String, originTime: String, destinationTime: String, diff --git a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt index 5adcfa41..7138171d 100644 --- a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt +++ b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt @@ -72,6 +72,12 @@ fun LegView( .copy(alpha = 0.1f), shape = RoundedCornerShape(12.dp), ) + .clickable( + interactionSource = remember { MutableInteractionSource() }, + indication = null, + onClick = { displayNonProminentStops = !displayNonProminentStops }, + role = Role.Button, + ) .padding(vertical = 12.dp, horizontal = 12.dp), ) { FlowRow( @@ -128,27 +134,17 @@ fun LegView( color = timelineColor, strokeWidth = strokeWidth, ) - .clickable( - interactionSource = remember { MutableInteractionSource() }, - indication = null, - onClick = { displayNonProminentStops = !displayNonProminentStops }, - role = Role.Button, - ) .padding(start = 16.dp, top = 12.dp), ) { if (stops.size > 2) { val context = LocalContext.current StopsRow( // Need to pass count twice - https://developer.android.com/guide/topics/resources/string-resource#Plurals - stops = if (displayNonProminentStops) { - "Hide stops" - } else { - context.resources.getQuantityString( - R.plurals.stops, - stops.size - 2, - stops.size - 2, - ) - }, + stops = context.resources.getQuantityString( + R.plurals.stops, + stops.size - 2, + stops.size - 2, + ), line = transportModeLine, ) } else { diff --git a/feature/trip-planner/ui/src/main/res/values/strings.xml b/feature/trip-planner/ui/src/main/res/values/strings.xml index 9b6d375e..b390ac19 100644 --- a/feature/trip-planner/ui/src/main/res/values/strings.xml +++ b/feature/trip-planner/ui/src/main/res/values/strings.xml @@ -5,7 +5,7 @@ To Destination Time Table - Show %d stop - Show %d stops + %d stop + %d stops