Represents a specific trip. Used to register callbacks for trip data changes. The trip automatically updates in the background if active callbacks are registered.
Public Constructor Summary
Public Method Summary
abstract ConsumerTripOptions |
getConsumerTripOptions()
Returns the current
ConsumerTripOptions set for this trip.
|
abstract TripInfo |
getTripInfo()
Return
TripInfo object containing information about the current trip.
|
abstract String |
getTripName()
Gets the trip name.
|
abstract boolean |
isRefreshing()
Returns whether ConsumerTrip is actively updating itself with fresh trip
information from Fleet Engine.
|
abstract boolean |
isTripCallbackRegistered(ConsumerTripCallback
callback)
Returns whether this callback is registered.
|
abstract void |
registerTripCallback(LifecycleOwner lifecycleOwner, boolean
updateInBackground,
ConsumerTripCallback callback)
Registers a callback to receive updates to this trip.
|
abstract void |
registerTripCallbackWithoutLifecycleOwner(ConsumerTripCallback
callback)
Similar to
registerTripCallback(LifecycleOwner, boolean, ConsumerTripCallback) ,
but without monitoring a LifecycleOwner .
|
abstract void |
setConsumerTripOptions(ConsumerTripOptions
options)
Sets
ConsumerTripOptions to configure this trip.
|
abstract void |
unregisterTripCallback(ConsumerTripCallback
callback)
Unregisters the callback registered with
registerTripCallback(LifecycleOwner, boolean, ConsumerTripCallback) .
|
Inherited Method Summary
Public Constructors
public ConsumerTrip ()
Public Methods
public abstract ConsumerTripOptions getConsumerTripOptions ()
Returns the current
ConsumerTripOptions
set for this trip.
public abstract TripInfo getTripInfo ()
Return
TripInfo
object containing information about the current trip.
public abstract String getTripName ()
Gets the trip name.
Returns
- The trip name string.
public abstract boolean isRefreshing ()
Returns whether ConsumerTrip is actively updating itself with fresh trip information
from Fleet Engine. ConsumerTrip only refreshes if it has registered callbacks, so this
will return false
if ConsumerTrip has no callbacks registered.
public abstract boolean isTripCallbackRegistered (ConsumerTripCallback callback)
Returns whether this callback is registered.
public abstract void registerTripCallback (LifecycleOwner lifecycleOwner, boolean updateInBackground, ConsumerTripCallback callback)
Registers a callback to receive updates to this trip. Updates will be delivered on the main thread.
Parameters
lifecycleOwner | The
LifecycleOwner to monitor for the callback. The callback will
automatically be unregistered when the LifecycleOwner is destroyed. Use
setConsumerTripOptions(ConsumerTripOptions) to set the refresh interval
range. |
---|---|
updateInBackground | Whether or not the callback should be called when the
LifecycleOwner is in the background (paused). If this is false, the
callback will only be called when the LifecycleOwner is in an active
state (resumed). |
callback | The
ConsumerTripCallback to call when the trip changes. |
public abstract void registerTripCallbackWithoutLifecycleOwner (ConsumerTripCallback callback)
Similar to
registerTripCallback(LifecycleOwner, boolean, ConsumerTripCallback)
, but
without monitoring a LifecycleOwner
.
Parameters
callback | The callback to call when the trip changes. |
---|
public abstract void setConsumerTripOptions (ConsumerTripOptions options)
Sets
ConsumerTripOptions
to configure this trip.
public abstract void unregisterTripCallback (ConsumerTripCallback callback)
Unregisters the callback registered with
registerTripCallback(LifecycleOwner, boolean, ConsumerTripCallback)
.
Parameters
callback | The callback to unregister. |
---|