public final class SavedTrip extends Trip implements Parcelable, Cloneable
SavedTrip is a Trip the user has customized in any way and is the only type of Trip
that can be saved to a user's itinerary. A SavedTrip includes a schedule and notification
settings for the Trip, along with an option to override these settings for a single day
(today only).
Any changes made to an existing SavedTrip or any new SavedTrip must be persisted
using TripManager.saveTrip(com.inrix.sdk.TripManager.SaveTripOptions, com.inrix.sdk.TripManager.ISaveTripResponseListener). After calling saveTrip, the updated
SavedTrip should be used instead of the one used to call the method.
Example: Creating a new saved trip (with no waypoints or notifications)
// Create a TripPoint for origin
final GeoPoint homeCoordinates = new GeoPoint(47.61527, -122.3285);
final TripPoint origin = new TripPoint("Home", homeCoordinates);
// Create a TripPoint for destination
final GeoPoint workCoordinates = new GeoPoint(48.61527, -123.3285);
final TripPoint destination = new TripPoint("Work", workCoordinates);
// Create the schedule for this trip - remember to set timezone to UTC
final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTime.set(2015, 3, 1, 9, 0, 0); // Starting on March 1, 2015 at 9AM - timezone is not relevant here
final TripSchedule.RecurringScheduleOptions scheduleOptions =
new TripSchedule.RecurringScheduleOptions(TripSchedule.ScheduleType.DEPARTURE,
dateTime.getTime(),
Arrays.asList(Calendar.MONDAY, Calendar.TUESDAY,
Calendar.WEDNESDAY, Calendar.THURSDAY,
Calendar.FRIDAY));
final TripSchedule schedule = new TripSchedule(scheduleOptions, null);
// Create the trip
final SavedTrip result = new SavedTrip(origin, destination, schedule);| Modifier and Type | Class and Description |
|---|---|
static class |
SavedTrip.RoutePreference
RoutePreference represents the preferred route for a SavedTrip. |
static class |
SavedTrip.SavedTripException
An exception that is thrown when there is an error with a
SavedTrip operation. |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>| Modifier and Type | Field and Description |
|---|---|
static Parcelable.Creator<SavedTrip> |
CREATOR
Parcelable creator for this type.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE| Constructor and Description |
|---|
SavedTrip(TripPoint origin,
TripPoint destination,
List<TripPoint> waypoints,
Schedule schedule)
Create a
SavedTrip with the given origin, destination, waypoints and schedule. |
SavedTrip(TripPoint origin,
TripPoint destination,
Schedule schedule)
Create a
SavedTrip with the given origin, destination and notification. |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
int |
describeContents() |
boolean |
equals(Object o) |
ContactInfoCollection |
getAssociatedContacts()
Gets the contacts associated with current
SavedTrip. |
TripPoint |
getDestination()
Get the final destination of the
SavedTrip. |
TripPoint |
getOrigin()
Get the origin of the
SavedTrip. |
int |
getRouteCriteria()
Get the route criteria for this
SavedTrip. |
SavedTrip.RoutePreference |
getRoutePreference()
Get the route preference for this
SavedTrip. |
Schedule |
getSchedule()
Get the schedule associated with this trip.
|
List<TripPoint> |
getWaypoints()
Get the ordered list of waypoints along the
SavedTrip. |
int |
hashCode() |
void |
setDestination(TripPoint destination)
Set the final destination of the
SavedTrip. |
void |
setOrigin(TripPoint origin)
Set the origin of the
SavedTrip. |
int |
setRouteCriteria(int routeCriteria)
Set additional route criteria for this
SavedTrip. |
SavedTrip.RoutePreference |
setRoutePreference(SavedTrip.RoutePreference routePreference)
Set the route preference for this
SavedTrip. |
void |
setSchedule(Schedule schedule)
Set the schedule for this trip.
|
void |
setWaypoints(List<TripPoint> waypoints)
Set the ordered list of waypoints along the
SavedTrip. |
String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final Parcelable.Creator<SavedTrip> CREATOR
public SavedTrip(TripPoint origin, TripPoint destination, List<TripPoint> waypoints, Schedule schedule)
SavedTrip with the given origin, destination, waypoints and schedule.origin - origin of the trip, must not be nulldestination - destination of the trip, must not be nullwaypoints - waypoints along the trip, optional and may be nullschedule - schedule of the trip, must not be nullpublic SavedTrip(TripPoint origin, TripPoint destination, Schedule schedule)
SavedTrip with the given origin, destination and notification.origin - origin of the trip, must not be nulldestination - destination of the trip, must not be nullschedule - schedule of the trip, must not be nullpublic void writeToParcel(Parcel dest, int flags)
writeToParcel in interface Parcelablepublic int describeContents()
describeContents in interface Parcelablepublic TripPoint getOrigin()
SavedTrip.SavedTrippublic void setOrigin(TripPoint origin)
SavedTrip.origin - origin of the SavedTrippublic TripPoint getDestination()
SavedTrip.SavedTrippublic void setDestination(TripPoint destination)
SavedTrip.destination - destination of the SavedTrippublic Schedule getSchedule()
public void setSchedule(Schedule schedule)
schedule - trip schedule, must not be nullpublic SavedTrip.RoutePreference setRoutePreference(SavedTrip.RoutePreference routePreference)
SavedTrip.routePreference - route preferenceSavedTrip.RoutePreferencepublic SavedTrip.RoutePreference getRoutePreference()
SavedTrip.
If no preference has been specified by the user, the default is SavedTrip.RoutePreference.FASTEST.SavedTrip.RoutePreferencepublic int setRouteCriteria(int routeCriteria)
SavedTrip.
The criteria is expressed as a bit field with the following possible values:
routeCriteria - route criteriaRouteManagerpublic int getRouteCriteria()
SavedTrip.
If no criteria has been specified by the user, the default value is RouteManager.ROUTE_CRITERIA_NO_RESTRICTIONS.RouteManagerpublic List<TripPoint> getWaypoints()
SavedTrip.SavedTrippublic void setWaypoints(List<TripPoint> waypoints)
SavedTrip.waypoints - ordered list of waypoints along the SavedTrippublic ContactInfoCollection getAssociatedContacts()
SavedTrip.ContactInfo associated with current saved trip.Copyright © 2013-2016 INRIX, Inc. All Rights Reserved.