PublicTransportBriefRouteViewModel

ViewModel for a route summary.

Provides essential route information at a glance and handles user interactions with the card.

Implementations may hold resources (e.g., coroutine scopes for async schedule loading). Call close when the ViewModel is no longer needed to release them.

Inheritors

Properties

Link copied to clipboard

Timezone of the route's destination point.

Link copied to clipboard
abstract val isExpanded: StateFlow<Boolean>

Current expansion state of the route card. When true, the card displays detailed information (e.g., full schedule, transfer details). When false, only brief summary is shown (e.g., total duration, arrival time, total fare).

Link copied to clipboard
abstract val routeSegments: StateFlow<List<RouteSegment>>

Ordered list of route segments that together form the complete journey. Each element represents a contiguous part of the route between two points. The sequence follows chronological order from departure to arrival.

Link copied to clipboard
abstract val scheduleGroups: StateFlow<List<ScheduleGroup>>

Schedule groups for the first public transport segment.

Link copied to clipboard
abstract val totalDuration: Duration

Total travel duration from start to end of the route. Excludes waiting times and transfer times.

Link copied to clipboard
abstract val totalFare: FareInfo?

Total fare for the entire journey. Includes both the amount and the currency for proper formatting.

Functions

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract fun onCardClick()

Handles click on the route card body.

Link copied to clipboard
abstract fun onRouteActionClick()

Handles click on the primary route action button (for example, "Go").

Link copied to clipboard
abstract fun onRouteDetailsClick()

Handles click on the route details/info action.

Link copied to clipboard
abstract fun setExpanded(value: Boolean)

Updates card expansion state.