Class LocationComponentOptions
- All Implemented Interfaces:
android.os.Parcelable
LocationComponent
class. Alternatively, if properties need to be changed at runtime depending on a specific state,
you can build an instance of this class, setting the values you desire, and then passing it into
either the LocationComponent activation method (if it isn't initialized yet) or
LocationComponent.applyStyle(LocationComponentOptions).
When the createFromAttributes(Context, int) methods called, any attributes not found
inside the style will revert back to using their default set values. Likewise, when building a
new LocationComponentOptions class using the builder, any options neglecting to be set will
reset to their default values.
If you would like to keep your custom style changes while modifying a single attribute, you can
get the currently used options object using LocationComponent.getLocationComponentOptions()
and it's toBuilder method to modify a single entry while also maintaining the other
settings. Once your modifications have been made, you'll need to pass it back into the location
component using LocationComponent.applyStyle(LocationComponentOptions).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructing a new instance ofLocationComponentOptions. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatDefault maximum radius of the LocationComponent circle when it's pulsing.static final android.os.Parcelable.Creator<LocationComponentOptions>Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionLocationComponentOptions(float accuracyAlpha, int accuracyColor, int backgroundDrawableStale, String backgroundStaleName, int foregroundDrawableStale, String foregroundStaleName, int gpsDrawable, String gpsName, int foregroundDrawable, String foregroundName, int backgroundDrawable, String backgroundName, int bearingDrawable, String bearingName, Integer bearingTintColor, Integer foregroundTintColor, Integer backgroundTintColor, Integer foregroundStaleTintColor, Integer backgroundStaleTintColor, float elevation, boolean enableStaleState, long staleStateTimeout, int[] padding, float maxZoomIconScale, float minZoomIconScale, boolean trackingGesturesManagement, float trackingInitialMoveThreshold, float trackingMultiFingerMoveThreshold, android.graphics.RectF trackingMultiFingerProtectedMoveArea, String layerAbove, String layerBelow, float trackingAnimationDurationMultiplier, boolean compassAnimationEnabled, boolean accuracyAnimationEnabled, Boolean pulseEnabled, Boolean pulseFadeEnabled, Integer pulseColor, float pulseSingleDuration, float pulseMaxRadius, float pulseAlpha, android.view.animation.Interpolator pulseInterpolator) protectedLocationComponentOptions(android.os.Parcel in) -
Method Summary
Modifier and TypeMethodDescriptionfloatSet the opacity of the accuracy view to a value from 0 to 1, where 0 means the accuracy view is completely transparent and 1 means the view is completely opaque.booleanEnable or disable smooth animation of the accuracy circle around the user's position.intSolid color to use as the accuracy view color property.intDefines the drawable used for the background state icon.intDefines the drawable used for the stale background icon.String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_backgroundDrawable.String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will use this image in place of the provided or default trimblemaps_foregroundDrawableStale.Defines the background stale color as an integer.Defines the background color as an integer.intDefines the drawable used for the bearing icon.String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_bearingDrawable.Defines the bearing icon color as an integer.builder(android.content.Context context) Build a new instance of theLocationComponentOptionsclass with all the attributes set automatically to their defined defaults in this library.booleanEnable or disable smooth animation of compass values forCameraModeandRenderMode.static LocationComponentOptionscreateFromAttributes(android.content.Context context, int styleRes) Construct a new Location Component Options class using the attributes found within a style resource.intfloatSets the base elevation of this view, in pixels.booleanEnable or disable to stale state mode.booleanintSupply a Drawable that is to be rendered on top of all of the content in the Location LayerComponent layer stack.intDefines the drawable used for the stale foreground icon.String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_foregroundDrawable.String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_foregroundDrawableStale.Defines the foreground stale color as an integer.Defines the foreground color as an integer.intDefines the drawable used for the navigation state icon.gpsName()String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_gpsDrawable.inthashCode()Gets the id of the layer that's referenced when placing the component on the map usingStyle.addLayerAbove(Layer, String).Gets the id of the layer that's referenced when placing the component on the map usingStyle.addLayerBelow(Layer, String).floatThe scale factor of the location icon when the map is zoomed in.floatThe scale factor of the location icon when the map is zoomed out.int[]padding()Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.floatThe opacity of the LocationComponent's circle as it pulses.Color of the LocationComponent's pulsing circle as it pulses.Enable or disable the LocationComponent's pulsing circle.Enable or disable fading of the LocationComponent's pulsing circle.android.view.animation.InterpolatorThe interpolator type of animation for the movement of the LocationComponent's circlefloatThe maximum radius that a single pulse should expand the LocationComponent's pulsing circle to.floatThe number of milliseconds it takes for a single pulse of the LocationComponent's pulsing circle.longSet the delay before the location icon becomes stale.Takes the currently constructedLocationComponentOptionsobject and provides it's builder with all the values set matching the values in this instance.toString()floatGet the tracking animation duration multiplier.booleanReturns whether gesture threshold should be adjusted when camera is in one of the tracking modes.floatMinimum single pointer movement in pixels required to break camera tracking.floatMinimum multi pointer movement in pixels required to break camera tracking (for example during scale gesture).android.graphics.RectFProtected multi pointer gesture area.voidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
CIRCLE_PULSING_MAX_RADIUS_DEFAULT
public static final float CIRCLE_PULSING_MAX_RADIUS_DEFAULTDefault maximum radius of the LocationComponent circle when it's pulsing.- See Also:
-
CREATOR
-
-
Constructor Details
-
LocationComponentOptions
public LocationComponentOptions(float accuracyAlpha, int accuracyColor, int backgroundDrawableStale, @Nullable String backgroundStaleName, int foregroundDrawableStale, @Nullable String foregroundStaleName, int gpsDrawable, @Nullable String gpsName, int foregroundDrawable, @Nullable String foregroundName, int backgroundDrawable, @Nullable String backgroundName, int bearingDrawable, @Nullable String bearingName, @Nullable Integer bearingTintColor, @Nullable Integer foregroundTintColor, @Nullable Integer backgroundTintColor, @Nullable Integer foregroundStaleTintColor, @Nullable Integer backgroundStaleTintColor, float elevation, boolean enableStaleState, long staleStateTimeout, @Nullable int[] padding, float maxZoomIconScale, float minZoomIconScale, boolean trackingGesturesManagement, float trackingInitialMoveThreshold, float trackingMultiFingerMoveThreshold, android.graphics.RectF trackingMultiFingerProtectedMoveArea, String layerAbove, String layerBelow, float trackingAnimationDurationMultiplier, boolean compassAnimationEnabled, boolean accuracyAnimationEnabled, Boolean pulseEnabled, Boolean pulseFadeEnabled, Integer pulseColor, float pulseSingleDuration, float pulseMaxRadius, float pulseAlpha, @Nullable android.view.animation.Interpolator pulseInterpolator) -
LocationComponentOptions
protected LocationComponentOptions(android.os.Parcel in)
-
-
Method Details
-
createFromAttributes
@NonNull public static LocationComponentOptions createFromAttributes(@NonNull android.content.Context context, @StyleRes int styleRes) Construct a new Location Component Options class using the attributes found within a style resource. It's important to note that you only need to define the attributes you plan to change and can safely ignore the other attributes which will be set to their default value.- Parameters:
context- your activity's context used for acquiring resourcesstyleRes- the style id where your custom attributes are defined- Returns:
- a new
LocationComponentOptionsobject with the settings you defined in your style resource
-
toBuilder
Takes the currently constructedLocationComponentOptionsobject and provides it's builder with all the values set matching the values in this instance. This allows you to modify a single attribute and then rebuild the object.- Returns:
- the builder which contains the values defined in this current instance as defaults.
-
builder
@NonNull public static LocationComponentOptions.Builder builder(@NonNull android.content.Context context) Build a new instance of theLocationComponentOptionsclass with all the attributes set automatically to their defined defaults in this library. This allows you to adjust a few attributes while leaving the rest alone and maintaining their default behavior.- Parameters:
context- your activities context used to acquire the style resource- Returns:
- the builder which contains the default values defined by the style resource
-
accuracyAlpha
public float accuracyAlpha()Set the opacity of the accuracy view to a value from 0 to 1, where 0 means the accuracy view is completely transparent and 1 means the view is completely opaque. References style attribute R.styleable#LocationComponent_accuracyAlpha- Returns:
- the opacity of the accuracy view
-
accuracyColor
@ColorInt public int accuracyColor()Solid color to use as the accuracy view color property. References style attribute R.styleable#LocationComponent_accuracyColor- Returns:
- the color of the accuracy view
-
backgroundDrawableStale
@DrawableRes public int backgroundDrawableStale()Defines the drawable used for the stale background icon. References style attribute R.styleable#LocationComponent_backgroundDrawableStale- Returns:
- the drawable resource ID
-
backgroundStaleName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will use this image in place of the provided or default trimblemaps_foregroundDrawableStale.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
foregroundDrawableStale
@DrawableRes public int foregroundDrawableStale()Defines the drawable used for the stale foreground icon. References style attribute R.styleable#LocationComponent_foregroundDrawableStale- Returns:
- the drawable resource ID
-
foregroundStaleName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_foregroundDrawableStale.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
gpsDrawable
@DrawableRes public int gpsDrawable()Defines the drawable used for the navigation state icon. References style attribute R.styleable#LocationComponent_gpsDrawable- Returns:
- the drawable resource ID
-
gpsName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_gpsDrawable.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
foregroundDrawable
@DrawableRes public int foregroundDrawable()Supply a Drawable that is to be rendered on top of all of the content in the Location LayerComponent layer stack. References style attribute R.styleable#LocationComponent_foregroundDrawable- Returns:
- the drawable resource used for the foreground layer
-
foregroundName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_foregroundDrawable.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
backgroundDrawable
@DrawableRes public int backgroundDrawable()Defines the drawable used for the background state icon. References style attribute R.styleable#LocationComponent_backgroundDrawable- Returns:
- the drawable resource ID
-
backgroundName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_backgroundDrawable.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
bearingDrawable
@DrawableRes public int bearingDrawable()Defines the drawable used for the bearing icon. References style attribute R.styleable#LocationComponent_bearingDrawable- Returns:
- the drawable resource ID
-
bearingName
String image name, identical to one used in the first parameter ofStyle.addImage(String, Bitmap), the component, will used this image in place of the provided or default trimblemaps_bearingDrawable.A maki-icon name (example: "circle-15") may also be provided. These are images that can be loaded with certain styles. Note, this will fail if the provided icon name is not provided by the loaded map style.
- Returns:
- String icon or maki-icon name
-
bearingTintColor
Defines the bearing icon color as an integer. References style attribute R.styleable#LocationComponent_bearingTintColor- Returns:
- the color integer resource
-
foregroundTintColor
Defines the foreground color as an integer. References style attribute R.styleable#LocationComponent_foregroundTintColor- Returns:
- the color integer resource
-
backgroundTintColor
Defines the background color as an integer. References style attribute R.styleable#LocationComponent_backgroundTintColor- Returns:
- the color integer resource
-
foregroundStaleTintColor
Defines the foreground stale color as an integer. References style attribute R.styleable#LocationComponent_foregroundStaleTintColor- Returns:
- the color integer resource
-
backgroundStaleTintColor
Defines the background stale color as an integer. References style attribute R.styleable#LocationComponent_backgroundStaleTintColor- Returns:
- the color integer resource
-
elevation
@Dimension public float elevation()Sets the base elevation of this view, in pixels. To turn off the shadow that appears under the location icon, set the elevation to 0. References style attribute R.styleable#LocationComponent_elevation- Returns:
- the elevation currently set for the location component icon
-
enableStaleState
public boolean enableStaleState()Enable or disable to stale state mode. This mode indicates to the user that the location being displayed on the map hasn't been updated in a specific amount of time. References style attribute R.styleable#LocationComponent_enableStaleState- Returns:
- whether the stale state mode is enabled or not
-
staleStateTimeout
public long staleStateTimeout()Set the delay before the location icon becomes stale. The timer begins approximately when a new location update comes in and using this defined time, if an update hasn't occured by the end, the location is considered stale. References style attribute R.styleable#LocationComponent_staleStateDelay- Returns:
- the duration in milliseconds which it should take before the location is considered stale
-
padding
@Nullable public int[] padding()Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. When the value of this property is equal to {0,0,0,0}, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.- Returns:
- integer array of padding values
-
maxZoomIconScale
public float maxZoomIconScale()The scale factor of the location icon when the map is zoomed in. Scaling is linear.- Returns:
- icon scale factor
-
minZoomIconScale
public float minZoomIconScale()The scale factor of the location icon when the map is zoomed out. Scaling is linear.- Returns:
- icon scale factor
-
trackingGesturesManagement
public boolean trackingGesturesManagement()Returns whether gesture threshold should be adjusted when camera is in one of the tracking modes. This will adjust the focal point and increase thresholds to enable camera manipulation, like zooming in and out, without breaking tracking.Note: If set to true, this can overwrite some of the gesture thresholds and the custom
AndroidGesturesManagerthat was set withTrimbleMapsMap.setGesturesManager(AndroidGesturesManager, boolean, boolean).- Returns:
- true if gestures are adjusted when in one of the camera tracking modes, false otherwise
- See Also:
-
trackingInitialMoveThreshold
public float trackingInitialMoveThreshold()Minimum single pointer movement in pixels required to break camera tracking.- Returns:
- the minimum movement
-
trackingMultiFingerMoveThreshold
public float trackingMultiFingerMoveThreshold()Minimum multi pointer movement in pixels required to break camera tracking (for example during scale gesture).- Returns:
- the minimum movement
-
trackingMultiFingerProtectedMoveArea
@Nullable public android.graphics.RectF trackingMultiFingerProtectedMoveArea()Protected multi pointer gesture area. When the camera is in a tracking mode, any multi finger gesture with focal point inside the provided screen coordinate rectangle is not going to break the tracking.Best paired with the
LocationComponentOptions.Builder.trackingMultiFingerMoveThreshold(float)set to 0 or a relatively small value to not interfere with gestures outside of the defined rectangle.- Returns:
- the protected multi finger area while camera is tracking
-
layerAbove
Gets the id of the layer that's referenced when placing the component on the map usingStyle.addLayerAbove(Layer, String).The component is going to placed directly above this layer.
- Returns:
- layerAbove the id of the layer the component is going to placed directly above.
-
layerBelow
Gets the id of the layer that's referenced when placing the component on the map usingStyle.addLayerBelow(Layer, String).The component is going to placed directly below this layer.
- Returns:
- layerBelow the id of the layer the component is going to placed directly below.
-
trackingAnimationDurationMultiplier
public float trackingAnimationDurationMultiplier()Get the tracking animation duration multiplier.- Returns:
- tracking animation duration multiplier
-
compassAnimationEnabled
public boolean compassAnimationEnabled()Enable or disable smooth animation of compass values forCameraModeandRenderMode.- Returns:
- whether smooth compass animation is enabled
-
accuracyAnimationEnabled
public boolean accuracyAnimationEnabled()Enable or disable smooth animation of the accuracy circle around the user's position.- Returns:
- whether smooth animation of the accuracy circle is enabled
-
pulseEnabled
Enable or disable the LocationComponent's pulsing circle.- Returns:
- whether the LocationComponent's pulsing circle is enabled
-
pulseFadeEnabled
Enable or disable fading of the LocationComponent's pulsing circle. If it fades, the circle's opacity decreases as its radius increases.- Returns:
- whether fading of the LocationComponent's pulsing circle is enabled
-
pulseColor
Color of the LocationComponent's pulsing circle as it pulses.- Returns:
- the current set color of the circle
-
pulseSingleDuration
public float pulseSingleDuration()The number of milliseconds it takes for a single pulse of the LocationComponent's pulsing circle.- Returns:
- the current set length of time for a single pulse
-
pulseMaxRadius
public float pulseMaxRadius()The maximum radius that a single pulse should expand the LocationComponent's pulsing circle to.- Returns:
- the maximum radius that the pulsing circle will expand to.
-
pulseAlpha
public float pulseAlpha()The opacity of the LocationComponent's circle as it pulses. The expected range is 0 to 1. An opacity of 1 makes the layer fully visible.- Returns:
- the current opacity of the LocationComponent's pulsing circle
-
pulseInterpolator
@Nullable public android.view.animation.Interpolator pulseInterpolator()The interpolator type of animation for the movement of the LocationComponent's circle- Returns:
- the current set type of animation interpolator for the pulsing circle
-
toString
-
equals
-
hashCode
public int hashCode() -
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-