public class

SteerpathMapView

extends MapView
java.lang.Object
   ↳ com.mapbox.mapboxsdk.maps.MapView
     ↳ com.steerpath.sdk.maps.SteerpathMapView

Class Overview

The SteerpathMapView extends the MapView provided by Mapbox in order to implement features that relate to indoor positoning.

In order to control the SteerpathMapView, the SteerpathMap should be used. It is the controller for this view. In order to obtain a reference to the controller SteerpathMap, you should use the method getMapAsync(OnMapReadyCallback).

Summary

Nested Classes
interface SteerpathMapView.LocateMeButtonListener Application may interrupt LocateMe-button clicks with this callback. 
@interface SteerpathMapView.LocateMeButtonMode  
interface SteerpathMapView.OnPermissionsNotGrantedListener OnMissingPermissionsListener notifies if runtime permission are not granted and it blocks usage of SteerpathMapView. 
Constants
int BEHAVIOR_ROTATE_CAMERA Cone is pointed upwards and camera is rotated.
int BEHAVIOR_ROTATE_CONE Cone is pointing where user is looking at and camera not rotated.
Public Constructors
SteerpathMapView(Context context)
Create a new SteerpathMapView.
SteerpathMapView(Context context, AttributeSet attrs)
Create a new SteerpathMapView.
SteerpathMapView(Context context, AttributeSet attrs, int defStyleAttr)
Create a new SteerpathMapView.
SteerpathMapView(Context context, MapboxMapOptions options)
Create a new SteerpathMapView.
Public Methods
void acceptRoute(RouteOptionsFactory factory)
Exits "overview map" mode and starts actual navigation.
void acceptRoute()
Exits "overview map" mode and starts actual navigation.
void addCustomView(View view)
Adds View below LocateMe-button.
final void enableFollowMeButton(boolean isEnabled)
Show or hide FollowMe button.
final void enableLevelPicker(boolean isEnabled)
Show or hide LevelPickerView.
void getMapAsync(OnMapReadyCallback callback)
Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
MetaFeature getRenderedMetaFeature(LatLng point)
Queries rendered (mapbox) Features and returns (Steerpath) Feature in response.
void hideBottomSheet()
Hide BottomSheetView with animation.
boolean isInRoutePreviewMode()
Checks if previewRoute(RoutePlan, RouteListener) has been called but acceptRoute() has not been yet called.
boolean isNavigating()
Checks if navigation was previously started with previewRoute() or navigateTo().
void launchCompassCalibrationDialog()
Convenience method to launch in-built compass calibration dialog.
void navigateTo(RoutePlan plan, RouteListener listener)
Draws a route line and starts navigation with "snap-to-path".
void navigateTo(Waypoint waypoint)
Continues navigation to Waypoint.
void navigateTo(RoutePlan plan, RouteOptionsFactory factory, RouteListener listener)
Draws a route line and starts navigation with "snap-to-path".
void nextWaypoint(Waypoint currentWaypoint)
void notifyDirectionSheetCanceled()
update(Context, DirectionSheet.Data)} is not called anymore until DirectionSheet is shown again.
void onCreate(Bundle savedInstanceState)

You must call this method from the parent's onCreate(Bundle) or onCreate(Bundle).

void onDestroy()
You must call this method from the parent's onDestroy() or onDestroy().
void onLowMemory()
You must call this method from the parent's onLowMemory() or onLowMemory().
void onPause()
You must call this method from the parent's onPause() or onPause().
void onResume()
You must call this method from the parent's onResume() or onResume().
void onSaveInstanceState(Bundle outState)
You must call this method from the parent's onSaveInstanceState(Bundle) or onSaveInstanceState(Bundle).
void onStart()
You must call this method from the parent's onStart() or onStart().
void onStop()
You must call this method from the parent's onStop() or onStop().
void pauseNavigation()
Pauses ongoing navigation.
void previewRoute(RoutePlan plan, RouteListener listener)
Calculate route to destination and show "overview map" before starting actual navigation.
void previewRoute(RoutePlan plan, RouteOptionsFactory factory, RouteListener listener)
Calculate route to destination and show "overview map" before starting actual navigation.
void removeCustomView(View view)
Removes View that was previously added with addCustomView().
void resumeNavigation()
Resumes previously paused navigation.
void setBlueDotHeadingModeBehavior(int behavior)
Change the way how map and heading cone works in BlueDotMode.HEADING mode.
void setBottomSheetCallback(BottomSheetCallback callback)
Registers a callback and notifies whne BottomSheet state changes.
void setBottomSheetContent(View content)
Put your custom View into BottomSheet.
void setBottomSheetPeekSize(int peekSize)
Set peek area height.
void setCompassCalibrationDialogEnabled(boolean isEnabled)
When going to BlueDotMode.HEADING, SDK may automatically prompt Compass Calibration Dialog.
void setCompassCalibrationRecommendedListener(CompassUtils.Listener listener)
Listens Compass calibration recommended -events.
void setDirectionSheet(DirectionSheet sheet)
Set custom renderer for contents of "directions list".
void setLocateMeButtonListener(SteerpathMapView.LocateMeButtonListener listener)
With LocateMeButtonListener, app may intercept LocateMe-button clicks.
void setLocateMeButtonModes(int[] toggleModes)
Add or remove toggleable states for LocateMe-button.
void setMarkerBottomSheetContentProvider(MarkerBottomSheetContentProvider markerBottomSheetContentProvider)
void setOnMapClickListener(OnMapClickListener onMapClickListener)
Set the listener for receiving map clicks.
void setOnMarkerClickListener(OnMarkerClickListener onMarkerClickListener)
Set the listener for marker clicks.
void setOnPermissionsNotGrantedListener(SteerpathMapView.OnPermissionsNotGrantedListener listener)
User of SteerpathMapView must make sure that proper permissions are granted.
void setRoutePreviewHolder(RoutePreviewHolder holder)
Set custom renderer for route preview badge in BottomSheet.
void setRouteStepViewHolder(RouteStepViewHolder holder)
Set custom renderer for contents of step-by-step routing bagde in BottomSheet.
void setWaypointViewHolder(WaypointViewHolder holder)
Set custom renderer for Waypoint badge in BottomSheet
void showWaypointViewHolder(Waypoint waypoint)
Updates BottomSheet component with WaypointViewHolder.
void stopNavigation()
Stops navigation that was previously started with navigateTo().
void updateRoutePlan(RoutePlan plan)
If onReRouteRecommended(RoutePlan)} returns true, app can give new RoutePlan and continue navigation with that.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int BEHAVIOR_ROTATE_CAMERA

Cone is pointed upwards and camera is rotated.

Constant Value: 0 (0x00000000)

public static final int BEHAVIOR_ROTATE_CONE

Cone is pointing where user is looking at and camera not rotated.

Constant Value: 1 (0x00000001)

Public Constructors

public SteerpathMapView (Context context)

Create a new SteerpathMapView.

Parameters
context the context in which this map view is created.

public SteerpathMapView (Context context, AttributeSet attrs)

Create a new SteerpathMapView.

Parameters
context the context in which this map view is created.
attrs attributeset for this view

public SteerpathMapView (Context context, AttributeSet attrs, int defStyleAttr)

Create a new SteerpathMapView.

Parameters
context the context in which this map view is created.
attrs attribute set for this view
defStyleAttr default style attribute

public SteerpathMapView (Context context, MapboxMapOptions options)

Create a new SteerpathMapView.

Parameters
context the context in which this map view is created.
options the options to be used for this map instance

Public Methods

public void acceptRoute (RouteOptionsFactory factory)

Exits "overview map" mode and starts actual navigation. Valid after previewRoute(RoutePlan, RouteListener) or previewRoute(RoutePlan, RouteOptionsFactory, RouteListener). Deprecated: use routeOptionsFactory(RouteOptionsFactory) instead of override default appearance.

Parameters
factory customize route line appearance

public void acceptRoute ()

Exits "overview map" mode and starts actual navigation. Valid after previewRoute(RoutePlan, RouteListener) or previewRoute(RoutePlan, RouteOptionsFactory, RouteListener).

public void addCustomView (View view)

Adds View below LocateMe-button. Parent ViewGroup is LinearLayout (vertical).

public final void enableFollowMeButton (boolean isEnabled)

Show or hide FollowMe button. Enabled by default.

public final void enableLevelPicker (boolean isEnabled)

Show or hide LevelPickerView. Enabled by default.

public void getMapAsync (OnMapReadyCallback callback)

Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.

Parameters
callback The callback object that will be triggered when the map is ready to be used.

public MetaFeature getRenderedMetaFeature (LatLng point)

Queries rendered (mapbox) Features and returns (Steerpath) Feature in response.

public void hideBottomSheet ()

Hide BottomSheetView with animation.

public boolean isInRoutePreviewMode ()

Checks if previewRoute(RoutePlan, RouteListener) has been called but acceptRoute() has not been yet called.

public boolean isNavigating ()

Checks if navigation was previously started with previewRoute() or navigateTo().

public void launchCompassCalibrationDialog ()

Convenience method to launch in-built compass calibration dialog.

public void navigateTo (RoutePlan plan, RouteListener listener)

Draws a route line and starts navigation with "snap-to-path". Does not have "overview map" mode. Call is valid after getMapAsync(OnMapReadyCallback). If navigateTo() is called while previous navigation is still in progress, the first request will be stopped automatically and replaced with the second request.

public void navigateTo (Waypoint waypoint)

Continues navigation to Waypoint. Updates BottomSheet.

public void navigateTo (RoutePlan plan, RouteOptionsFactory factory, RouteListener listener)

Draws a route line and starts navigation with "snap-to-path". Does not have "overview map" mode. Call is valid after getMapAsync(OnMapReadyCallback). If navigateTo() is called while previous navigation is still in progress, the first request will be stopped automatically and replaced with the second request.

Deprecated: use routeOptionsFactory(RouteOptionsFactory) instead of override default appearance.

Parameters
factory customize route line appearance

public void nextWaypoint (Waypoint currentWaypoint)

public void notifyDirectionSheetCanceled ()

update(Context, DirectionSheet.Data)} is not called anymore until DirectionSheet is shown again.

public void onCreate (Bundle savedInstanceState)

You must call this method from the parent's onCreate(Bundle) or onCreate(Bundle).

Parameters
savedInstanceState Pass in the parent's savedInstanceState.

public void onDestroy ()

You must call this method from the parent's onDestroy() or onDestroy().

Stops MapServer and nullifies SteerpathMap. If fake location was enabled, it will be disabled now.

public void onLowMemory ()

You must call this method from the parent's onLowMemory() or onLowMemory().

public void onPause ()

You must call this method from the parent's onPause() or onPause().

public void onResume ()

You must call this method from the parent's onResume() or onResume().

public void onSaveInstanceState (Bundle outState)

You must call this method from the parent's onSaveInstanceState(Bundle) or onSaveInstanceState(Bundle).

Parameters
outState Pass in the parent's outState.

public void onStart ()

You must call this method from the parent's onStart() or onStart().

public void onStop ()

You must call this method from the parent's onStop() or onStop().

public void pauseNavigation ()

Pauses ongoing navigation. Does following:
- hides BottomSheet
- disables rerouting

public void previewRoute (RoutePlan plan, RouteListener listener)

Calculate route to destination and show "overview map" before starting actual navigation. Call is valid after getMapAsync(OnMapReadyCallback). To start navigation, call acceptRoute() or acceptRoute(RouteOptionsFactory). To cancel, call stopNavigation().

If origin and destination are in different buildings, route line is drawn "globally" ignoring selected building and floor.

public void previewRoute (RoutePlan plan, RouteOptionsFactory factory, RouteListener listener)

Calculate route to destination and show "overview map" before starting actual navigation. Call is valid after getMapAsync(OnMapReadyCallback). To start navigation, call acceptRoute() or acceptRoute(RouteOptionsFactory). To cancel, call stopNavigation().

If origin and destination are in different buildings, route line is drawn "globally" ignoring selected building and floor.

Deprecated: Deprecated: use previewRouteOptionsFactory(RouteOptionsFactory) instead of override default appearance.

Parameters
factory customize route line appearance

public void removeCustomView (View view)

Removes View that was previously added with addCustomView().

public void resumeNavigation ()

Resumes previously paused navigation. Does following:
- Shows BottomSheet
- enables rerouting

public void setBlueDotHeadingModeBehavior (int behavior)

Change the way how map and heading cone works in BlueDotMode.HEADING mode. Default value is BEHAVIOR_ROTATE_CAMERA.

public void setBottomSheetCallback (BottomSheetCallback callback)

Registers a callback and notifies whne BottomSheet state changes.

public void setBottomSheetContent (View content)

Put your custom View into BottomSheet. It can be taller that R.dimens.bottom_bar_peek because BottomSheetView scrolls vertically.

public void setBottomSheetPeekSize (int peekSize)

Set peek area height. Floating Action Buttons and FloorSwitcher will be pushed upwards accordingly.

public void setCompassCalibrationDialogEnabled (boolean isEnabled)

When going to BlueDotMode.HEADING, SDK may automatically prompt Compass Calibration Dialog. Enables or disabled this feature.

public void setCompassCalibrationRecommendedListener (CompassUtils.Listener listener)

Listens Compass calibration recommended -events. To show default dialog, call launchCompassCalibrationDialog() or show some other dialog.

public void setDirectionSheet (DirectionSheet sheet)

Set custom renderer for contents of "directions list". List will be displayed when step-by-step routing badge is clicked.

public void setLocateMeButtonListener (SteerpathMapView.LocateMeButtonListener listener)

With LocateMeButtonListener, app may intercept LocateMe-button clicks. SDK internally handles permissions, disabled Bluetooth configuration etc before click events are delivered to the application.

public void setLocateMeButtonModes (int[] toggleModes)

Add or remove toggleable states for LocateMe-button.
This does not affect toggleMapMode(), setMapMode(SteerpathMap.MapMode)}, toggleBlueDotMode() or setBlueDotMode(SteerpathMap.BlueDotMode). These methods can be still called and they will have effect even if corresponding LocateMeButtonMode value is not declared in setLocateMeButtonModes().

Duplicate LocateMeButtonModes are silently ignored.

Default configuration is:
SteerpathMapView.LocateMeButtonMode.NORMAL
SteerpathMapView.LocateMeButtonMode.FOLLOW_USER
SteerpathMapView.LocateMeButtonMode.HEADING
If device does not have compass, SteerpathMapView.LocateMeButtonMode.HEADING will be ignored.

Parameters
toggleModes list of LocateMeButtonMode values in order they should be toggled
Throws
IllegalArgumentException if param toggles is null or empty
IllegalArgumentException if first @LocateMeButtonMode is not LocateMeButtonMode.NORMAL

public void setMarkerBottomSheetContentProvider (MarkerBottomSheetContentProvider markerBottomSheetContentProvider)

public void setOnMapClickListener (OnMapClickListener onMapClickListener)

Set the listener for receiving map clicks. This interface overrides the one provided by MapboxMapView in order to support normal SteerpathMap behavior.

Parameters
onMapClickListener the listener which should get notified when the map is clicked

public void setOnMarkerClickListener (OnMarkerClickListener onMarkerClickListener)

Set the listener for marker clicks. This interface overrides the one provided by MapboxMapView in order to support normal SteerpathMap behavior.

Parameters
onMarkerClickListener the listener which should get notified if markers are clicked.

public void setOnPermissionsNotGrantedListener (SteerpathMapView.OnPermissionsNotGrantedListener listener)

User of SteerpathMapView must make sure that proper permissions are granted. Calling setOnPermissionsNotGrantedListener enables permission checking and error indicator.

After granting permissions, FusedLocationProviderApi.Api.get().refreshLocationSources() must be called.

public void setRoutePreviewHolder (RoutePreviewHolder holder)

Set custom renderer for route preview badge in BottomSheet.

public void setRouteStepViewHolder (RouteStepViewHolder holder)

Set custom renderer for contents of step-by-step routing bagde in BottomSheet.

public void setWaypointViewHolder (WaypointViewHolder holder)

Set custom renderer for Waypoint badge in BottomSheet

public void showWaypointViewHolder (Waypoint waypoint)

Updates BottomSheet component with WaypointViewHolder.

public void stopNavigation ()

Stops navigation that was previously started with navigateTo(). Removes existing route line. This method is called internally from onDestroy()

public void updateRoutePlan (RoutePlan plan)

If onReRouteRecommended(RoutePlan)} returns true, app can give new RoutePlan and continue navigation with that.