Class MapSheetFragment

java.lang.Object
androidx.fragment.app.Fragment
com.arubanetworks.meridian.maps.MapSheetFragment
All Implemented Interfaces:
ComponentCallbacks, View.OnCreateContextMenuListener, ActivityResultCaller, HasDefaultViewModelProviderFactory, LifecycleOwner, ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner, OrientationDetector.Listener, LocationSharing.Listener, MapView.DirectionsEventListener, MapView.MapClickEventListener, MapView.MapEventListener, MapView.MarkerEventListener, TagStream.Listener

A Fragment for providing an interactive Meridian map surface with map and directions controls.
  • Constructor Details

    • MapSheetFragment

      public MapSheetFragment()
  • Method Details

    • getMapOptions

      public MapOptions getMapOptions()
      Gets a copy of the current MapOptions, defaulting to the MapView options if none are set on this fragment or the default ones if a MapView was not initialized yet.

      Changing the properties of the returned MapOptions will have no effect. To change the MapOptions for this MapFragment, call setMapOptions.

    • setMapOptions

      public void setMapOptions(MapOptions options)
      Set current map options.

      These will be applied to our owned MapView instance either immediately if it exists, or automatically when created.

    • getDirectionsOptions

      public DirectionsOptions getDirectionsOptions()
      Gets a copy of the current DirectionsOptions, defaulting to the MapView options if none are set on this fragment or the default ones if a MapView was not initialized yet.

      Changing the properties of the returned DirectionsOptions will have no effect. To change the DirectionsOptions for this MapFragment, call setDirectionsOptions.

    • setDirectionsOptions

      public void setDirectionsOptions(DirectionsOptions options)
      Set current directions options.

      These will be applied to our owned MapView instance either immediately if it exists, or automatically when created.

    • getMapView

      public MapView getMapView()
      Gets our owned MapView if created, otherwise null.

      You may call methods and set properties on the returned view.

    • setMarkerEventListener

      public void setMarkerEventListener(MapView.MarkerEventListener listener)
      Set the MarkerEventListener for this MapFragment.
    • setDirectionsEventListener

      public void setDirectionsEventListener(MapView.DirectionsEventListener listener)
      Set the DirectionsEventListener for this MapFragment.
    • setMapEventListener

      public void setMapEventListener(MapView.MapEventListener listener)
      Set the MapEventListener for this MapFragment.
    • setMapClickEventListener

      public void setMapClickEventListener(MapView.MapClickEventListener listener)
      Set the MapClickEventListener for this MapFragment.
    • onCreate

      public void onCreate(Bundle savedInstanceState)
      Overrides:
      onCreate in class Fragment
    • onSaveInstanceState

      public void onSaveInstanceState(@NonNull Bundle outState)
      Overrides:
      onSaveInstanceState in class Fragment
    • onCreateView

      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
      Overrides:
      onCreateView in class Fragment
    • onStart

      public void onStart()
      Overrides:
      onStart in class Fragment
    • onResume

      public void onResume()
      Overrides:
      onResume in class Fragment
    • onPause

      public void onPause()
      Overrides:
      onPause in class Fragment
    • onStop

      public void onStop()
      Overrides:
      onStop in class Fragment
    • onDestroyView

      public void onDestroyView()
      Overrides:
      onDestroyView in class Fragment
    • setMapSheetEventListener

      public void setMapSheetEventListener(MapSheetFragment.MapSheetEventListener listener)
      Set the MapSheetEventListener for this MapSheetFragment.
      Parameters:
      listener - The MapSheetFragment.MapSheetEventListener for this MapSheetFragment.
    • startDirections

      public void startDirections(DirectionsDestination destination)
      Start directions to the given placemark.
    • endDirections

      public void endDirections()
      End directions to the given placemark.
    • onActivityResult

      public void onActivityResult(int requestCode, int resultCode, Intent data)
      Overrides:
      onActivityResult in class Fragment
    • onSourceResult

      protected void onSourceResult(DirectionsDestination destination, DirectionsSource source)
      This event takes place right before directions are retrieved from the server and provide an opportunity to change the source and destination, or just be notified of the event.

      Make sure to call super or the directions request will be canceled.

    • onMarkerSelect

      public boolean onMarkerSelect(Marker marker)
      Description copied from interface: MapView.MarkerEventListener
      Called when a user taps a Marker on the map.
      Specified by:
      onMarkerSelect in interface MapView.MarkerEventListener
      Parameters:
      marker - An instance of the marker that was tapped.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onMarkerDeselect

      public boolean onMarkerDeselect(Marker marker)
      Description copied from interface: MapView.MarkerEventListener
      Called when a user taps somewhere on the map deselecting a marker.
      Specified by:
      onMarkerDeselect in interface MapView.MarkerEventListener
      Parameters:
      marker - An instance of the marker that was previously selected.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • markerForPlacemark

      public Marker markerForPlacemark(Placemark placemark)
      Description copied from interface: MapView.MarkerEventListener
      This method is an opportunity to supply your own Marker instance for a given Placemark.

      You can use this to completely customize the look of Placemarks on the map. The default implementation returns null.

      Specified by:
      markerForPlacemark in interface MapView.MarkerEventListener
      Parameters:
      placemark - The Placemark that is requesting a Marker for displaying on the map.
      Returns:
      A new instance of a Marker subclass or null to request that MapView create a default Marker.
    • markerForHiddenPlacemark

      public Marker markerForHiddenPlacemark(Placemark placemark)
    • markerForSelectedMarker

      public Marker markerForSelectedMarker(Marker markerToSelect)
      Description copied from interface: MapView.MarkerEventListener
      This method is an opportunity to supply your own selected Marker instance for a selected Marker.

      You can use this to completely customize the look of selected Placemarks on the map. The default implementation returns null.

      Specified by:
      markerForSelectedMarker in interface MapView.MarkerEventListener
      Parameters:
      markerToSelect - The Marker that is being selected.
      Returns:
      A new instance of a Marker subclass or null to request that MapView create a default Marker.
    • onTagsUpdated

      public void onTagsUpdated(List<TagBeacon> tags)
      Description copied from interface: TagStream.Listener
      Provides a list of tags which were heard
      Specified by:
      onTagsUpdated in interface TagStream.Listener
      Parameters:
      tags - list of assets tags with position
    • onTagsRemoved

      public void onTagsRemoved(List<TagBeacon> tags)
      Description copied from interface: TagStream.Listener
      Provides a list of tags which were removed from the backend.

      Note that if a tag leaves the map, this callback will NOT be fired.

      Specified by:
      onTagsRemoved in interface TagStream.Listener
      Parameters:
      tags - list of tags which were deleted
    • onRenderFriendsEvent

      @Subscribe(threadMode=MAIN) public void onRenderFriendsEvent(com.arubanetworks.meridian.maps.MapSheetFragment.RenderFriendsEvent ev)
    • onCalloutClick

      public boolean onCalloutClick(Marker marker)
      Description copied from interface: MapView.MarkerEventListener
      Called when the callout is tapped.

      The callout is the screen footer which lists the marker name and has a directions button.

      Specified by:
      onCalloutClick in interface MapView.MarkerEventListener
      Parameters:
      marker - An instance of the marker that was active when the callout was tapped.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onMapLoadStart

      public void onMapLoadStart()
      Description copied from interface: MapView.MapEventListener
      Called when initial loading of a map starts, this is called before any web request or graphics related loading happens.
      Specified by:
      onMapLoadStart in interface MapView.MapEventListener
    • onMapLoadFinish

      public void onMapLoadFinish()
      Description copied from interface: MapView.MapEventListener
      Called after loading of the map image is complete.

      It has not been rendered at this point.

      Specified by:
      onMapLoadFinish in interface MapView.MapEventListener
    • onPlacemarksLoadFinish

      public void onPlacemarksLoadFinish()
      Description copied from interface: MapView.MapEventListener
      Called after loading Placemarks.

      This is a good place to add your own markers and edit data in the loaded Placemarks before they are rendered to the screen.

      Specified by:
      onPlacemarksLoadFinish in interface MapView.MapEventListener
    • onMapRenderFinish

      public void onMapRenderFinish()
      Description copied from interface: MapView.MapEventListener
      Called after the map and Placemarks have been loaded and rendered.

      Changing any markers should be avoided.

      Specified by:
      onMapRenderFinish in interface MapView.MapEventListener
    • onMapLoadFail

      public void onMapLoadFail(Throwable tr)
      Description copied from interface: MapView.MapEventListener
      Called when there has been an error retrieving the map from the internet or parsing the map that was retrieved.
      Specified by:
      onMapLoadFail in interface MapView.MapEventListener
      Parameters:
      tr - Exception that occurred while loading map.
    • onMapTransformChange

      public void onMapTransformChange(Matrix transform)
      Description copied from interface: MapView.MapEventListener
      Called when screen to map transform for this map changes.
      Specified by:
      onMapTransformChange in interface MapView.MapEventListener
      Parameters:
      transform - new transform matrix.
    • onLocationUpdated

      public void onLocationUpdated(MeridianLocation location)
      Description copied from interface: MapView.MapEventListener
      Called when the Location has updated for this map.
      Specified by:
      onLocationUpdated in interface MapView.MapEventListener
      Parameters:
      location - The updated location.
    • onOrientationUpdated

      public void onOrientationUpdated(MeridianOrientation orientation)
      Description copied from interface: MapView.MapEventListener
      Called when orientation of the device has been updated.
      Specified by:
      onOrientationUpdated in interface MapView.MapEventListener
      Parameters:
      orientation - The updated orientation.
    • onLocationButtonClick

      public boolean onLocationButtonClick()
      Description copied from interface: MapView.MapClickEventListener
      Called when the user clicks the Location button.
      Specified by:
      onLocationButtonClick in interface MapView.MapClickEventListener
      Returns:
      true if the event has been handled, false if we still want the default behavior to occur.
    • onOverviewButtonClick

      public boolean onOverviewButtonClick()
      Description copied from interface: MapView.MapClickEventListener
      Called when the user clicks the Overview button.

      Note that the overview button is in the upper left corner of the map and only appears if there is a map without a building that is the default map. This is not associated with the overview button in directions.

      Specified by:
      onOverviewButtonClick in interface MapView.MapClickEventListener
      Returns:
      true if the event has been handled, false if we still want the default behavior to occur.
    • onMapClick

      public boolean onMapClick()
      Description copied from interface: MapView.MapClickEventListener
      Called when the user clicks on the map, but not on a control or Marker.

      In most cases this should be an indicator that the user is trying to dismiss the active UI.

      Specified by:
      onMapClick in interface MapView.MapClickEventListener
      Returns:
      true if the event has been handled, false if we still want the default behavior to occur.
    • onLongPress

      public boolean onLongPress(float x, float y)
      Description copied from interface: MapView.MapClickEventListener
      Called when the user long presses on the map.
      Specified by:
      onLongPress in interface MapView.MapClickEventListener
      Returns:
      true if the event has been handled, false if we still want the default behavior to occur.
    • onDirectionsReroute

      public void onDirectionsReroute()
      Description copied from interface: MapView.DirectionsEventListener
      Called when the directions need to reroute.
      Specified by:
      onDirectionsReroute in interface MapView.DirectionsEventListener
    • onDirectionsClick

      public boolean onDirectionsClick(Marker marker)
      Description copied from interface: MapView.DirectionsEventListener
      Called when the directions action of the marker callout view is tapped.
      Specified by:
      onDirectionsClick in interface MapView.DirectionsEventListener
      Parameters:
      marker - An instance of the marker that was active when the callout was tapped.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onDirectionsStart

      public boolean onDirectionsStart()
      Description copied from interface: MapView.DirectionsEventListener
      Called when the directions are calculated.
      Specified by:
      onDirectionsStart in interface MapView.DirectionsEventListener
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onRouteStepIndexChange

      public boolean onRouteStepIndexChange(int index)
      Description copied from interface: MapView.DirectionsEventListener
      Called when the route step has been updated.
      Specified by:
      onRouteStepIndexChange in interface MapView.DirectionsEventListener
      Parameters:
      index - The index of the updated step.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onDirectionsClosed

      public boolean onDirectionsClosed()
      Description copied from interface: MapView.DirectionsEventListener
      Called when the user exits directions.
      Specified by:
      onDirectionsClosed in interface MapView.DirectionsEventListener
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onDirectionsError

      public boolean onDirectionsError(Throwable tr)
      Description copied from interface: MapView.DirectionsEventListener
      Called when there has been an error getting directions.
      Specified by:
      onDirectionsError in interface MapView.DirectionsEventListener
      Parameters:
      tr - Exception that occurred while loading directions.
      Returns:
      true to indicate that the event has been handled, false to allow the default action to take place.
    • onUseAccessiblePathsChange

      public void onUseAccessiblePathsChange()
      Description copied from interface: MapView.DirectionsEventListener
      Called when the accessibility option has been toggled by the user.
      Specified by:
      onUseAccessiblePathsChange in interface MapView.DirectionsEventListener
    • onOrientationRight

      public void onOrientationRight()
      Specified by:
      onOrientationRight in interface OrientationDetector.Listener
    • onOrientationWrong

      public void onOrientationWrong()
      Specified by:
      onOrientationWrong in interface OrientationDetector.Listener
    • addPlacemarkTypes

      public static void addPlacemarkTypes(String mapId, HashMap<String,MapSheetFragment.PlacemarkCountTuple> placemarkTypes)
    • getPlacemarkTypesForMap

      public static HashMap<String,MapSheetFragment.PlacemarkCountTuple> getPlacemarkTypesForMap(String mapId)
    • onOpenLinkEvent

      @Subscribe(threadMode=MAIN) public void onOpenLinkEvent(OpenLinkEvent ev)
    • onBottomSheetEvent

      @Subscribe(threadMode=MAIN) public void onBottomSheetEvent(BottomSheetEvent event)
    • onBottomSheetStateEvent

      @Subscribe(threadMode=MAIN) public void onBottomSheetStateEvent(BottomSheetStateEvent event)
    • onSearchResultSelected

      public void onSearchResultSelected(DirectionsDestination destination, DirectionsStartSearchResult result)
    • onSearchCanceled

      public void onSearchCanceled()
    • onPostingLocationUpdatesStarted

      public void onPostingLocationUpdatesStarted()
      Specified by:
      onPostingLocationUpdatesStarted in interface LocationSharing.Listener
    • onFriendsUpdated

      public void onFriendsUpdated(List<Friend> friendList)
      Specified by:
      onFriendsUpdated in interface LocationSharing.Listener
    • onPostingLocationUpdatesStopped

      public void onPostingLocationUpdatesStopped()
      Specified by:
      onPostingLocationUpdatesStopped in interface LocationSharing.Listener
    • clearSearchRecents

      public static void clearSearchRecents(@Nullable EditorKey appKey, @NonNull Context context)
      Clear the search recents.
      Parameters:
      appKey -
      • application to clear search recents for, null to clear all
      context -
      • context
    • onMapChangedEvent

      @Subscribe(threadMode=MAIN) public void onMapChangedEvent(MapChangedEvent ev)
    • onUpdateTagLocationEvent

      @Subscribe(threadMode=MAIN) public void onUpdateTagLocationEvent(TagBottomSheet.UpdateTagLocationEvent ev)
    • onCallPermissionEvent

      @Subscribe(threadMode=MAIN) public void onCallPermissionEvent(CallPermissionEvent ev)