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 Method Summary
TripInfo |
getTripInfo()
Return
TripInfo object containing information about the current trip.
|
TripModelOptions |
getTripModelOptions()
Returns the current
TripModelOptions set for this trip.
|
String |
getTripName()
Gets the trip name.
|
boolean |
isActive()
Returns whether TripModel is actively updating itself with fresh trip
information from Fleet Engine.
|
boolean | |
void |
registerTripCallback(LifecycleOwner lifecycleOwner, boolean
updateInBackground,
TripModelCallback callback)
Registers a callback to receive updates to this trip.
|
void |
registerTripCallback(TripModelCallback
callback)
Similar to
registerTripCallback(LifecycleOwner, boolean, TripModelCallback) ,
but without monitoring a LifecycleOwner .
|
void | |
void |
unregisterTripCallback(TripModelCallback
callback)
Unregisters the callback registered with
registerTripCallback(LifecycleOwner, boolean, TripModelCallback) .
|
Inherited Method Summary
Public Methods
public getTripInfo ()
Return
TripInfo
object containing information about the current trip.
public TripModelOptions getTripModelOptions ()
Returns the current
TripModelOptions
set for this trip.
public String getTripName ()
Gets the trip name.
Returns
- The trip name string.
public boolean isActive ()
Returns whether TripModel is actively updating itself with fresh trip information
from Fleet Engine. TripModel only refreshes if it has registered callbacks, so this
will return false
if TripModel has no callbacks registered.
public boolean isTripCallbackRegistered (TripModelCallback callback)
Returns whether this callback is registered.
public void registerTripCallback (LifecycleOwner lifecycleOwner, boolean updateInBackground, TripModelCallback 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
setTripModelOptions(TripModelOptions) 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
TripModelCallback to call when the trip changes. |
public void registerTripCallback (TripModelCallback callback)
Similar to
registerTripCallback(LifecycleOwner, boolean, TripModelCallback)
, but
without monitoring a LifecycleOwner
.
Parameters
callback | The callback to call when the trip changes. |
---|
public void setTripModelOptions (TripModelOptions options)
Sets
TripModelOptions
to configure this trip.
public void unregisterTripCallback (TripModelCallback callback)
Unregisters the callback registered with
registerTripCallback(LifecycleOwner, boolean, TripModelCallback)
.
Parameters
callback | The callback to unregister. |
---|