-
- All Implemented Interfaces:
-
android.arch.lifecycle.LifecycleOwner
,android.arch.lifecycle.ViewModelStoreOwner
,android.content.ComponentCallbacks
,android.view.View.OnCreateContextMenuListener
,com.pointrlabs.core.management.ConfigurationManager.Listener
,com.pointrlabs.core.management.PTRListener
public final class PTRMapFragment extends PTRFragment implements ConfigurationManager.Listener
Default implementation for PTRMapFragment
Responsible for:
-> Displaying map -> All map interactions (map zoom in/out, scroll) -> Displaying Pois -> Displaying Position -> Displaying Path
The primary component under MapWidget.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
PTRMapFragment.Companion
-
Field Summary
Fields Modifier and Type Field Description private PathSession
currentPathSession
private Path
currentPath
private Double
zoomLevel
private Double
minimumZoomLevel
private Double
maximumZoomLevel
private Double
defaultLocationZoomLevel
private final Boolean
isMapFullyRendered
private final Poi
highlightedPoi
private Boolean
isJoystickEnabled
private List<String>
filteredPoiSet
private final Double
rotationalDirection
private final Integer
mState
private final Bundle
mSavedFragmentState
private final SparseArray<Parcelable>
mSavedViewState
private final Boolean
mSavedUserVisibleHint
private final Integer
mIndex
private final String
mWho
private final Bundle
mArguments
private final Fragment
mTarget
private final Integer
mTargetIndex
private final Integer
mTargetRequestCode
private final Boolean
mAdded
private final Boolean
mRemoving
private final Boolean
mFromLayout
private final Boolean
mInLayout
private final Boolean
mRestored
private final Boolean
mPerformedCreateView
private final Integer
mBackStackNesting
private final FragmentManagerImpl
mFragmentManager
private final FragmentHostCallback<Object>
mHost
private final FragmentManagerImpl
mChildFragmentManager
private final FragmentManagerNonConfig
mChildNonConfig
private final ViewModelStore
mViewModelStore
private final Fragment
mParentFragment
private final Integer
mFragmentId
private final Integer
mContainerId
private final String
mTag
private final Boolean
mHidden
private final Boolean
mDetached
private final Boolean
mRetainInstance
private final Boolean
mRetaining
private final Boolean
mHasMenu
private final Boolean
mMenuVisible
private final Boolean
mCalled
private final ViewGroup
mContainer
private final View
mView
private final View
mInnerView
private final Boolean
mDeferStart
private final Boolean
mUserVisibleHint
private final Fragment.AnimationInfo
mAnimationInfo
private final Boolean
mIsNewlyAdded
private final Boolean
mHiddenChanged
private final Float
mPostponedAlpha
private final LayoutInflater
mLayoutInflater
private final Boolean
mIsCreated
private final LifecycleRegistry
mLifecycleRegistry
private final LifecycleRegistry
mViewLifecycleRegistry
private final LifecycleOwner
mViewLifecycleOwner
private final MutableLiveData<LifecycleOwner>
mViewLifecycleOwnerLiveData
-
Constructor Summary
Constructors Constructor Description PTRMapFragment()
-
Method Summary
Modifier and Type Method Description final PathSession
getCurrentPathSession()
final Unit
setCurrentPathSession(PathSession currentPathSession)
final Path
getCurrentPath()
final Unit
setCurrentPath(Path currentPath)
final Double
getZoomLevel()
final Unit
setZoomLevel(Double zoomLevel)
final Double
getMinimumZoomLevel()
final Unit
setMinimumZoomLevel(Double minimumZoomLevel)
final Double
getMaximumZoomLevel()
final Unit
setMaximumZoomLevel(Double maximumZoomLevel)
final Double
getDefaultLocationZoomLevel()
final Unit
setDefaultLocationZoomLevel(Double defaultLocationZoomLevel)
final Boolean
getIsMapFullyRendered()
final Poi
getHighlightedPoi()
final Boolean
getIsJoystickEnabled()
Joystick to simulate user position should be displayed. final Unit
setIsJoystickEnabled(Boolean isJoystickEnabled)
final List<String>
getFilteredPoiSet()
Filters the map to show only the list of given poi ids. final Unit
setFilteredPoiSet(List<String> filteredPoiSet)
final Double
getRotationalDirection()
Unit
onCreate(Bundle savedInstanceState)
View
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Unit
onStart()
Unit
onResume()
Unit
onSaveInstanceState(Bundle outState)
Unit
onPause()
Unit
onStop()
Unit
onDestroyView()
Unit
onDestroy()
Unit
onLowMemory()
Unit
onConfigurationUpdate()
Configuration updated final Unit
loadAndSet(Level level, Boolean shouldZoomToLevel)
final Unit
loadAndSet(Building building)
When calling this method, the map widget will load the content for this building and related site, if necessary, and displays it. final Unit
loadAndSet(Site site)
When calling this method, the map widget will load the content for this site, if necessary, and displays it. final Unit
setLevel(Level level, Boolean shouldZoomLevel)
Updates map to display given Level final Unit
highlightPoi(Poi poi)
Highlights given Poi final Unit
unhighlightPoi(Poi poi)
Un-highlights given Poi final Unit
unhighlightAllPois()
Unhighlight all Poi final Unit
scrollToLocation(GeoPoint location, Double zoomLevel)
Scroll the map to given location final Unit
zoomToLocation(GeoPoint location)
Zooms the camera to given location with the default location zoom level. final Unit
setZoomLevel(Double zoomLevel, Boolean isAnimated)
Zooms the camera with desired zoom level. final Unit
rotateToDirection(Double direction, Boolean isAnimated)
Changed the heading of the map and optionally animates the change final Unit
resetNorth()
Resets the map rotation to a northern heading with animation. final Unit
addAnnotation(PTRMapViewMarker ptrMapViewMarker, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map final Unit
addAnnotation(PTRMapViewMarker ptrMapViewMarker, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map final Unit
addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map final Unit
addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map final Unit
addMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to add marker on the map final Unit
handleLevelChange(Level level)
final Unit
handleZoomChange(Double zoomLevel)
final Unit
removeMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to remove marker from the map final Unit
removeAnnotation(PTRMapViewMarker ptrMapViewMarker, Function0<Unit> completion)
invoke this method to remove an annotation on map final Unit
removeAnnotations(List<PTRMapViewMarker> ptrMapViewMarkers, Function0<Unit> completion)
invoke this method to remove annotations on map final Unit
removeAllAnnotations(Function0<Unit> completion)
invoke this method to remove all annotations on map final Unit
addLayer(PTRMapLayer layer, String belowLayerIdentifier, Function2<Boolean, String, Unit> completion)
Add layer to map final Unit
removeLayer(String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to remove a layer and corresponding source final Unit
addFeatures(List<Feature> features, String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to add multiple features to the map final Unit
removeFeatures(List<Feature> features, Function2<Boolean, String, Unit> completion)
invoke this method to remove multiple features from the map final Unit
removeAllFeatures(Function2<Boolean, String, Unit> completion)
invoke this method to remove all features -
Methods inherited from class com.pointrlabs.core.map.views.PTRMapFragment
getColor, hideKeyboard, onActivityCreated, showKeyboard, toast, toast
-
Methods inherited from class com.pointrlabs.core.map.views.helper_views.PTRFragment
callStartTransitionListener, dump, equals, findFragmentByWho, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getAnimatingAway, getAnimator, getArguments, getChildFragmentManager, getContext, getEnterTransition, getEnterTransitionCallback, getExitTransition, getExitTransitionCallback, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getNextAnim, getNextTransition, getNextTransitionStyle, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getStateAfterAnimating, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, initState, instantiateChildFragmentManager, isAdded, isDetached, isHidden, isHideReplaced, isInBackStack, isInLayout, isMenuVisible, isPostponed, isRemoving, isResumed, isStateSaved, isVisible, noteStateNotSaved, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onViewCreated, onViewStateRestored, peekChildFragmentManager, performActivityCreated, performConfigurationChanged, performContextItemSelected, performCreate, performCreateOptionsMenu, performCreateView, performDestroy, performDestroyView, performDetach, performGetLayoutInflater, performLowMemory, performMultiWindowModeChanged, performOptionsItemSelected, performOptionsMenuClosed, performPause, performPictureInPictureModeChanged, performPrepareOptionsMenu, performResume, performSaveInstanceState, performStart, performStop, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireContext, requireFragmentManager, requireHost, restoreChildFragmentState, restoreViewState, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setAnimatingAway, setAnimator, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setHideReplaced, setIndex, setInitialSavedState, setMenuVisibility, setNextAnim, setNextTransition, setOnStartEnterTransitionListener, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setStateAfterAnimating, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getCurrentPathSession
final PathSession getCurrentPathSession()
-
setCurrentPathSession
final Unit setCurrentPathSession(PathSession currentPathSession)
-
getCurrentPath
final Path getCurrentPath()
-
setCurrentPath
final Unit setCurrentPath(Path currentPath)
-
getZoomLevel
final Double getZoomLevel()
-
setZoomLevel
final Unit setZoomLevel(Double zoomLevel)
-
getMinimumZoomLevel
final Double getMinimumZoomLevel()
-
setMinimumZoomLevel
final Unit setMinimumZoomLevel(Double minimumZoomLevel)
-
getMaximumZoomLevel
final Double getMaximumZoomLevel()
-
setMaximumZoomLevel
final Unit setMaximumZoomLevel(Double maximumZoomLevel)
-
getDefaultLocationZoomLevel
final Double getDefaultLocationZoomLevel()
-
setDefaultLocationZoomLevel
final Unit setDefaultLocationZoomLevel(Double defaultLocationZoomLevel)
-
getIsMapFullyRendered
final Boolean getIsMapFullyRendered()
-
getHighlightedPoi
final Poi getHighlightedPoi()
-
getIsJoystickEnabled
final Boolean getIsJoystickEnabled()
Joystick to simulate user position should be displayed.
-
setIsJoystickEnabled
final Unit setIsJoystickEnabled(Boolean isJoystickEnabled)
-
getFilteredPoiSet
final List<String> getFilteredPoiSet()
Filters the map to show only the list of given poi ids. Keep in mind that this will be applied to all levels.
-
setFilteredPoiSet
final Unit setFilteredPoiSet(List<String> filteredPoiSet)
-
getRotationalDirection
final Double getRotationalDirection()
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
onSaveInstanceState
Unit onSaveInstanceState(Bundle outState)
-
onDestroyView
Unit onDestroyView()
-
onLowMemory
Unit onLowMemory()
-
onConfigurationUpdate
Unit onConfigurationUpdate()
Configuration updated
-
loadAndSet
final Unit loadAndSet(Level level, Boolean shouldZoomToLevel)
-
loadAndSet
final Unit loadAndSet(Building building)
When calling this method, the map widget will load the content for this building and related site, if necessary, and displays it. By default it displays the first level of the given building.
- Parameters:
building
- to be displayed
-
loadAndSet
final Unit loadAndSet(Site site)
When calling this method, the map widget will load the content for this site, if necessary, and displays it. By default it displays the first level of the first building of the given site.
- Parameters:
site
- to be displayed
-
setLevel
final Unit setLevel(Level level, Boolean shouldZoomLevel)
Updates map to display given Level
- Parameters:
level
- to display on mapshouldZoomLevel
- true if it is desired to zoom to the level
-
highlightPoi
final Unit highlightPoi(Poi poi)
Highlights given Poi
- Parameters:
poi
- to highlight
-
unhighlightPoi
final Unit unhighlightPoi(Poi poi)
Un-highlights given Poi
- Parameters:
poi
- to unhighlight
-
unhighlightAllPois
final Unit unhighlightAllPois()
Unhighlight all Poi
-
scrollToLocation
final Unit scrollToLocation(GeoPoint location, Double zoomLevel)
Scroll the map to given location
- Parameters:
location
- Location to be scrolled on mapzoomLevel
- Desired zoom level, current zoom level if not provided
-
zoomToLocation
final Unit zoomToLocation(GeoPoint location)
Zooms the camera to given location with the default location zoom level.
- Parameters:
location
- Location to be zoomed upon
-
setZoomLevel
final Unit setZoomLevel(Double zoomLevel, Boolean isAnimated)
Zooms the camera with desired zoom level.
- Parameters:
zoomLevel
- Desired zoom levelisAnimated
- Flag to determine zooming should be animated or not
-
rotateToDirection
final Unit rotateToDirection(Double direction, Boolean isAnimated)
Changed the heading of the map and optionally animates the change
- Parameters:
direction
- The heading of the map, measured in degrees clockwise from true northisAnimated
- Flag to determine changing should be animated or not.
-
resetNorth
final Unit resetNorth()
Resets the map rotation to a northern heading with animation.
-
addAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotation(PTRMapViewMarker ptrMapViewMarker, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map
- Parameters:
ptrMapViewMarker
-contains the data for annotation to be added
level
-the level on which the annotation has to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotation(PTRMapViewMarker ptrMapViewMarker, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map
- Parameters:
ptrMapViewMarker
-contains the data for annotation to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map
- Parameters:
ptrMapViewMarkerList
-contains the data for annotation to be added
level
-the level on which the annotation has to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map
- Parameters:
ptrMapViewMarkerList
-contains the data for annotation to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addMarker
final Unit addMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to add marker on the map
- Parameters:
ptrMapViewMarker
-the view to be added on the map
-
handleLevelChange
final Unit handleLevelChange(Level level)
-
handleZoomChange
final Unit handleZoomChange(Double zoomLevel)
-
removeMarker
final Unit removeMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to remove marker from the map
- Parameters:
ptrMapViewMarker
-the view to be removed from the map
-
removeAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `removeFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit removeAnnotation(PTRMapViewMarker ptrMapViewMarker, Function0<Unit> completion)
invoke this method to remove an annotation on map
- Parameters:
ptrMapViewMarker
-PTRMapViewMarker to be removed from the map
-
removeAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `removeFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit removeAnnotations(List<PTRMapViewMarker> ptrMapViewMarkers, Function0<Unit> completion)
invoke this method to remove annotations on map
- Parameters:
ptrMapViewMarkers
-list of PTRMapViewMarker to be removed from the map
-
removeAllAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `removeAllFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit removeAllAnnotations(Function0<Unit> completion)
invoke this method to remove all annotations on map
-
addLayer
final Unit addLayer(PTRMapLayer layer, String belowLayerIdentifier, Function2<Boolean, String, Unit> completion)
Add layer to map
- Parameters:
layer
- PTRMapLayer to be addedbelowLayerIdentifier
- layer identifier below which we are going to add new layer.completion
- completion unit to check if the layer is added successfully.
-
removeLayer
final Unit removeLayer(String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to remove a layer and corresponding source
- Parameters:
layerIdentifier
-layer identifier
-
addFeatures
final Unit addFeatures(List<Feature> features, String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to add multiple features to the map
- Parameters:
features
-features to be added
layerIdentifier
-the layer on which the features will be added
completion
-completion callback
-
removeFeatures
final Unit removeFeatures(List<Feature> features, Function2<Boolean, String, Unit> completion)
invoke this method to remove multiple features from the map
- Parameters:
features
-features to be removed
completion
-completion callback
-
removeAllFeatures
final Unit removeAllFeatures(Function2<Boolean, String, Unit> completion)
invoke this method to remove all features
- Parameters:
completion
-completion callback
-
-
-
-