public class AndroidXCompositeFragment
extends androidx.fragment.app.Fragment
implements com.nokia.maps.MapUi
AndroidXMapFragment in addition to AR
functionality.AndroidXMapFragment| Constructor and Description |
|---|
AndroidXCompositeFragment()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOnMapRenderListener(OnMapRenderListener listener)
Adds a
OnMapRenderListener to listen for map render events. |
ARController |
getARController()
Get
ARController |
ViewRect |
getClipRect()
Returns the
ViewRect representing the clip
rectangle for this AndroidXCompositeFragment. |
android.graphics.Rect |
getCopyrightBoundaryRect()
Gets the current HERE copyright logo's boundary rectangle.
|
int |
getCopyrightLogoHeight()
Returns the height of the copyright logo.
|
CopyrightLogoPosition |
getCopyrightLogoPosition()
Returns the on-screen position of the HERE copyright logo as a
CopyrightLogoPosition value. |
int |
getCopyrightLogoWidth()
Returns the width of the copyright logo.
|
int |
getCopyrightMargin()
Returns the current margin for the HERE copyright logo, in number of pixels, as an offset
from the edge of the visible map area to the edge of the logo.
|
int |
getHeight()
Gets the current height of the fragment, in pixels.
|
Map |
getMap()
Returns the instance of
Map associated with this fragment |
MapGesture |
getMapGesture()
Returns the
MapGesture object representing the current gesture handler for the
AndroidXCompositeFragment. |
void |
getScreenCapture(OnScreenCaptureListener listener)
Returns the full screen bitmap for the
AndroidXCompositeFragment. |
int |
getWidth()
Gets the current width of the fragment, in pixels.
|
void |
init(ApplicationContext context,
OnEngineInitListener listener)
Users of
AndroidXCompositeFragment must call this function after the fragment is
first attached to its activity. |
void |
init(OnEngineInitListener listener)
Users of
AndroidXCompositeFragment must call this function after the fragment is
first attached to its activity. |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroyView() |
void |
onInflate(android.content.Context context,
android.util.AttributeSet attrs,
android.os.Bundle savedInstanceState) |
void |
onPause()
Called when this fragment is no longer resumed.
|
void |
onResume()
Called when this fragment is visible to the user and actively running.
|
void |
onSaveInstanceState(android.os.Bundle outState) |
void |
removeOnMapRenderListener(OnMapRenderListener listener)
Removes an existing
OnMapRenderListener. |
void |
setClipRect(ViewRect rect)
Sets a clipping rectangle to this
AndroidXCompositeFragment. |
void |
setClipRect(ViewRect rect,
android.graphics.PointF transformCenter)
Sets a clipping rectangle to the
AndroidXCompositeFragment. |
void |
setCopyrightBoundaryRect(android.graphics.Rect rect)
Sets a rectangle, in pixels, relative to the top left corner of the
AndroidXCompositeFragment 's boundary, for the placement of the HERE copyright logo. |
void |
setCopyrightLogoPosition(CopyrightLogoPosition position)
Sets a position for the HERE copyright logo.
|
void |
setCopyrightMargin(int margin)
Sets a margin for the HERE copyright logo, in number of pixels, as an offset from the edge
of the visible map area to the edge of the logo (depending on the placement).
|
void |
setMapMarkerDragListener(MapMarker.OnDragListener listener)
Sets a
OnDragListener to be
invoked whenever any MapMarker on a Map that is attached to this fragment
is dragged. |
void |
setOnTouchListener(android.view.View.OnTouchListener listener)
Sets an
View.OnTouchListener to be invoked whenever a touch event is sent to the
AndroidXCompositeFragment. |
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onStart, onStop, onViewCreated, onViewStateRestored, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireContext, requireFragmentManager, requireHost, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenupublic void init(OnEngineInitListener listener)
AndroidXCompositeFragment must call this function after the fragment is
first attached to its activity. This automatically initializes the
MapEngine and creates an ARController
for use. This method is a convenience method that can be used for fragments embedded in a
layout XML. This method should not be used when programmatically creating an
AndroidXCompositeFragment.
This method will initialize MapEngine with MapEngine.MapVariant.GLOBAL map variant
on first SDK usage and with stored map variant on sub-sequent usages.
listener - A OnEngineInitListener
object that will be called when AndroidXCompositeFragment and
MapEngine initialization is finished. A null object can be
supplied if callers do not expect any notification when initialization completes.OnEngineInitListener,
MapEngine.init(ApplicationContext,OnEngineInitListener),
AndroidXCompositeFragment.init(ApplicationContext, com.here.android.mpa.common.OnEngineInitListener)public void init(ApplicationContext context, OnEngineInitListener listener)
AndroidXCompositeFragment must call this function after the fragment is
first attached to its activity. This automatically initializes the
MapEngine and creates an ARController
for use. This method is a convenience method that can be used for fragments embedded in a
layout XML. This method should not be used when programmatically creating an
AndroidXCompositeFragment.context - ApplicationContext to be used during initialization.listener - A OnEngineInitListener
object that will be called when AndroidXCompositeFragment and
MapEngine initialization is finished. A null object can be
supplied if callers do not expect any notification when initialization completes.OnEngineInitListener,
MapEngine.init(
com.here.android.mpa.common.ApplicationContext,
com.here.android.mpa.common.OnEngineInitListener),
AndroidXCompositeFragment.init(ApplicationContext, OnEngineInitListener)public android.view.View onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
onCreateView in class androidx.fragment.app.Fragmentpublic void onInflate(android.content.Context context,
android.util.AttributeSet attrs,
android.os.Bundle savedInstanceState)
onInflate in class androidx.fragment.app.Fragmentpublic void onResume()
MapEngine
activities will be resumed automatically.onResume in class androidx.fragment.app.FragmentFragment.onResume()public void onPause()
MapEngine activities will be
paused automatically.onPause in class androidx.fragment.app.FragmentFragment.onPause()public void onDestroyView()
onDestroyView in class androidx.fragment.app.Fragmentpublic void setOnTouchListener(android.view.View.OnTouchListener listener)
View.OnTouchListener to be invoked whenever a touch event is sent to the
AndroidXCompositeFragment.setOnTouchListener in interface com.nokia.maps.MapUilistener - An View.OnTouchListener to set for the AndroidXCompositeFragmentpublic ARController getARController()
ARControllerpublic int getWidth()
public int getHeight()
public void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState in class androidx.fragment.app.Fragmentpublic void getScreenCapture(OnScreenCaptureListener listener)
AndroidXCompositeFragment. This method is
asynchronous and will invoke a callback once the operation is completed through the
operation is completed through the
OnScreenCaptureListener
the AndroidXCompositeFragment must be visible to create the screen capture.
Note that the current functionality of this API is limited to getting a screen capture of
the Map. Future releases maybe enhanced to support getting screen capture of the AR and Map
composite.listener - A OnScreenCaptureListener to listen for the callback when screen capture
is complete.public Map getMap()
Map associated with this fragmentgetMap in interface com.nokia.maps.MapUiMap object currently displayed in this fragment.public ViewRect getClipRect()
ViewRect representing the clip
rectangle for this AndroidXCompositeFragment.getClipRect in interface com.nokia.maps.MapUiMapObjects and similar map-related screen elements. null if the view's
layout process has yet to be completed. If the process is not yet
complete, users can either retry later or subscribe as a
OnMapRenderListener and
call this method upon the callback
OnMapRenderListener.onSizeChanged(int,int).public void setClipRect(ViewRect rect, android.graphics.PointF transformCenter)
AndroidXCompositeFragment. Only the area specified
by the ViewRect will be used for rendering,
while the rest of the view will be masked in black. This rectangle will be reset to the
full size of the AndroidXCompositeFragment upon screen rotation or upon recreating
the screen.
Note that setting a clipping rectangle will also reset the
AndroidXCompositeFragment's viewing rectangle to its full default size.
If the ViewRect is not valid, this method does nothing.
setClipRect in interface com.nokia.maps.MapUirect - A ViewRect for rendering MapObjects and similar map-related screen elementstransformCenter - A PointF representing the center coordinate for map transformations such
as zooming and rotationAndroidXCompositeFragment.setClipRect(ViewRect)public void setClipRect(ViewRect rect)
AndroidXCompositeFragment. Only the area specified
by the ViewRect will be used for rendering,
while the rest of the view will be masked in black. This rectangle will be reset to the
full size of the AndroidXCompositeFragment upon screen rotation or upon recreating
the screen.
If the ViewRect is not valid, this method does nothing.
setClipRect in interface com.nokia.maps.MapUirect - A ViewRect for rendering MapObjects and similar map-related screen elementsAndroidXCompositeFragment.setClipRect(ViewRect, PointF)public android.graphics.Rect getCopyrightBoundaryRect()
null if a
boundary rect has not been set previously.getCopyrightBoundaryRect in interface com.nokia.maps.MapUinull if a boundary rect has not been set
previously.AndroidXCompositeFragment.setCopyrightBoundaryRect(Rect)public void setCopyrightBoundaryRect(android.graphics.Rect rect)
AndroidXCompositeFragment 's boundary, for the placement of the HERE copyright logo.
If the specified rectangle is not contained completely within the current visible map area, their area of intersection will be used instead of the specified rectangle's area. The copyright logo and copyright margin must fit into the rectangle, otherwise specified rectangle will be ignored.
The rectangle is reset upon screen rotation or upon screen re-creation, or it can be done
by setting a null-android.graphics.Rect.
setCopyrightBoundaryRect in interface com.nokia.maps.MapUirect - A android.graphics.Rect representing the desired rectangular container
to be used for positioning the copyright logo. Use null
android.graphics.Rect to reset the boundary container.java.lang.IllegalArgumentException - if android.graphics.Rect supplied is invalidpublic int getCopyrightMargin()
This method only returns a valid value once fragment initialization has taken place.
getCopyrightMargin in interface com.nokia.maps.MapUiAndroidXCompositeFragment, in number
of pixelspublic void setCopyrightMargin(int margin)
setCopyrightMargin in interface com.nokia.maps.MapUimargin - Desired offset from the edge of the AndroidXCompositeFragmentpublic int getCopyrightLogoWidth()
This method only returns a valid value once fragment initialization has completed.
getCopyrightLogoWidth in interface com.nokia.maps.MapUipublic int getCopyrightLogoHeight()
This method only returns a valid value once fragment initialization has taken completed.
getCopyrightLogoHeight in interface com.nokia.maps.MapUipublic CopyrightLogoPosition getCopyrightLogoPosition()
CopyrightLogoPosition value.getCopyrightLogoPosition in interface com.nokia.maps.MapUipublic void setCopyrightLogoPosition(CopyrightLogoPosition position)
After the logo's position is set, the position stays effective even when the screen is rotated or re-created.
setCopyrightLogoPosition in interface com.nokia.maps.MapUiposition - A CopyrightLogoPosition
value representing the desired placement of the HERE copyright logo with respect
to the visible map view areapublic MapGesture getMapGesture()
MapGesture object representing the current gesture handler for the
AndroidXCompositeFragment. Applications can intercept this object and override the
default event behaviors.getMapGesture in interface com.nokia.maps.MapUiMapGesturepublic void addOnMapRenderListener(OnMapRenderListener listener)
OnMapRenderListener to listen for map render events.addOnMapRenderListener in interface com.nokia.maps.MapUilistener - A OnMapRenderListener to add to the AndroidXCompositeFragmentAndroidXCompositeFragment.removeOnMapRenderListener(OnMapRenderListener)public void removeOnMapRenderListener(OnMapRenderListener listener)
OnMapRenderListener.removeOnMapRenderListener in interface com.nokia.maps.MapUilistener - A OnMapRenderListener to remove from the AndroidXCompositeFragmentpublic void setMapMarkerDragListener(MapMarker.OnDragListener listener)
OnDragListener to be
invoked whenever any MapMarker on a Map that is attached to this fragment
is dragged.setMapMarkerDragListener in interface com.nokia.maps.MapUilistener - An MapMarker.OnDragListener to set for this AndroidXCompositeFragment