/tripkit/TripKitAndroidUI/com.skedgo.tripkit.ui.tripresults.actionbutton/ActionButtonHandler

ActionButtonHandler

open class ActionButtonHandler

Trip results will display individual action buttons for different segments, for example, "View timetable" for public transit results, or "Ride motorbike" for motorbike results. You can customize the provided text and functionality that the action button provides by inheriting from this class, creating a ViewModelProvider.Factory to create it, and providing the factory to the TripResultListFragment builder.

Trip details can also show multiple actions, such as "Add to favorites" or "Route". Those should be provided by overriding getActions()

Inheritors

TKUIActionButtonHandler

Constructors

ActionButtonHandler constructor()

Types

Name Summary
Companion object Companion

Properties

Name Summary
container var container: ActionButtonContainer?
queryFromLocation var queryFromLocation: Location?
queryToLocation var queryToLocation: Location?

Functions

Name Summary
actionClicked open fun actionClicked(context: Context, tag: String, trip: Trip, viewModel: ActionButtonViewModel)
getActions open suspend fun getActions(context: Context, trip: Trip): List<ActionButton>
Given a trip, return a list of actions that can be taken. The default implementation lists nothing.
getPrimaryAction open fun getPrimaryAction(context: Context, trip: Trip): MutableLiveData<String>?
Given a trip, provide an action string, or return NULL if the action button should not be shown.
handleCustomAction open fun handleCustomAction(tag: String, data: Any)
primaryActionClicked open fun primaryActionClicked(trip: Trip)