Skip to content

Commit

Permalink
[TEMP] - UX braintorming with Adi
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz committed Oct 26, 2024
1 parent 5db4ab9 commit 63ef42b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -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,
),
)
}
}
Expand Down Expand Up @@ -298,7 +301,7 @@ fun JourneyCardContent(

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun ColumnScope.DefaultJourneyCardContent(
fun DefaultJourneyCardContent(
timeToDeparture: String,
originTime: String,
destinationTime: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions feature/trip-planner/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="to_text_field_placeholder">To Destination</string>
<string name="time_table_screen_title">Time Table</string>
<plurals name="stops">
<item quantity="one">Show %d stop</item>
<item quantity="other">Show %d stops</item>
<item quantity="one">%d stop</item>
<item quantity="other">%d stops</item>
</plurals>
</resources>

0 comments on commit 63ef42b

Please sign in to comment.