public class LocationComponentOptions
extends java.lang.Object
implements 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)
.
Modifier and Type | Class and Description |
---|---|
static class |
LocationComponentOptions.Builder
Builder class for constructing a new instance of
LocationComponentOptions . |
Modifier and Type | Field and Description |
---|---|
static float |
CIRCLE_PULSING_MAX_RADIUS_DEFAULT
Default maximum radius of the LocationComponent circle when it's pulsing.
|
static android.os.Parcelable.Creator<LocationComponentOptions> |
CREATOR |
Modifier | Constructor and Description |
---|---|
|
LocationComponentOptions(float accuracyAlpha,
int accuracyColor,
int backgroundDrawableStale,
java.lang.String backgroundStaleName,
int foregroundDrawableStale,
java.lang.String foregroundStaleName,
int gpsDrawable,
java.lang.String gpsName,
int foregroundDrawable,
java.lang.String foregroundName,
int backgroundDrawable,
java.lang.String backgroundName,
int bearingDrawable,
java.lang.String bearingName,
java.lang.Integer bearingTintColor,
java.lang.Integer foregroundTintColor,
java.lang.Integer backgroundTintColor,
java.lang.Integer foregroundStaleTintColor,
java.lang.Integer backgroundStaleTintColor,
float elevation,
boolean enableStaleState,
long staleStateTimeout,
int[] padding,
float maxZoomIconScale,
float minZoomIconScale,
boolean trackingGesturesManagement,
float trackingInitialMoveThreshold,
float trackingMultiFingerMoveThreshold,
android.graphics.RectF trackingMultiFingerProtectedMoveArea,
java.lang.String layerAbove,
java.lang.String layerBelow,
float trackingAnimationDurationMultiplier,
boolean compassAnimationEnabled,
boolean accuracyAnimationEnabled,
java.lang.Boolean pulseEnabled,
java.lang.Boolean pulseFadeEnabled,
java.lang.Integer pulseColor,
float pulseSingleDuration,
float pulseMaxRadius,
float pulseAlpha,
android.view.animation.Interpolator pulseInterpolator) |
protected |
LocationComponentOptions(android.os.Parcel in) |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
accuracyAnimationEnabled()
Enable or disable smooth animation of the accuracy circle around the user's position.
|
int |
accuracyColor()
Solid color to use as the accuracy view color property.
|
int |
backgroundDrawable()
Defines the drawable used for the background state icon.
|
int |
backgroundDrawableStale()
Defines the drawable used for the stale background icon.
|
java.lang.String |
backgroundName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_backgroundDrawable. |
java.lang.String |
backgroundStaleName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will use this image in place of the provided or default mapbox_foregroundDrawableStale. |
java.lang.Integer |
backgroundStaleTintColor()
Defines the background stale color as an integer.
|
java.lang.Integer |
backgroundTintColor()
Defines the background color as an integer.
|
int |
bearingDrawable()
Defines the drawable used for the bearing icon.
|
java.lang.String |
bearingName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_bearingDrawable. |
java.lang.Integer |
bearingTintColor()
Defines the bearing icon color as an integer.
|
static LocationComponentOptions.Builder |
builder(android.content.Context context)
Build a new instance of the
LocationComponentOptions class with all the attributes set
automatically to their defined defaults in this library. |
boolean |
compassAnimationEnabled()
Enable or disable smooth animation of compass values for
CameraMode
and RenderMode . |
static LocationComponentOptions |
createFromAttributes(android.content.Context context,
int styleRes)
Construct a new Location Component Options class using the attributes found within a style
resource.
|
int |
describeContents() |
float |
elevation()
Sets the base elevation of this view, in pixels.
|
boolean |
enableStaleState()
Enable or disable to stale state mode.
|
boolean |
equals(java.lang.Object o) |
int |
foregroundDrawable()
Supply a Drawable that is to be rendered on top of all of the content in the Location LayerComponent layer stack.
|
int |
foregroundDrawableStale()
Defines the drawable used for the stale foreground icon.
|
java.lang.String |
foregroundName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_foregroundDrawable. |
java.lang.String |
foregroundStaleName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_foregroundDrawableStale. |
java.lang.Integer |
foregroundStaleTintColor()
Defines the foreground stale color as an integer.
|
java.lang.Integer |
foregroundTintColor()
Defines the foreground color as an integer.
|
int |
gpsDrawable()
Defines the drawable used for the navigation state icon.
|
java.lang.String |
gpsName()
String image name, identical to one used in
the first parameter of
Style.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_gpsDrawable. |
int |
hashCode() |
java.lang.String |
layerAbove()
Gets the id of the layer that's referenced when placing the component on the map using
Style.addLayerAbove(Layer, String) . |
java.lang.String |
layerBelow()
Gets the id of the layer that's referenced when placing the component on the map using
Style.addLayerBelow(Layer, String) . |
float |
maxZoomIconScale()
The scale factor of the location icon when the map is zoomed in.
|
float |
minZoomIconScale()
The 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.
|
float |
pulseAlpha()
The opacity of the LocationComponent's circle as it pulses.
|
java.lang.Integer |
pulseColor()
Color of the LocationComponent's pulsing circle as it pulses.
|
java.lang.Boolean |
pulseEnabled()
Enable or disable the LocationComponent's pulsing circle.
|
java.lang.Boolean |
pulseFadeEnabled()
Enable or disable fading of the LocationComponent's pulsing circle.
|
android.view.animation.Interpolator |
pulseInterpolator()
The interpolator type of animation for the movement of the LocationComponent's circle
|
float |
pulseMaxRadius()
The maximum radius that a single pulse should expand the LocationComponent's pulsing circle to.
|
float |
pulseSingleDuration()
The number of milliseconds it takes for a single pulse of the LocationComponent's pulsing circle.
|
long |
staleStateTimeout()
Set the delay before the location icon becomes stale.
|
LocationComponentOptions.Builder |
toBuilder()
Takes the currently constructed
LocationComponentOptions object and provides it's builder
with all the values set matching the values in this instance. |
java.lang.String |
toString() |
float |
trackingAnimationDurationMultiplier()
Get the tracking animation duration multiplier.
|
boolean |
trackingGesturesManagement()
Returns whether gesture threshold should be adjusted when camera is in one of the tracking modes.
|
float |
trackingInitialMoveThreshold()
Minimum single pointer movement in pixels required to break camera tracking.
|
float |
trackingMultiFingerMoveThreshold()
Minimum multi pointer movement in pixels required to break camera tracking (for example during scale gesture).
|
android.graphics.RectF |
trackingMultiFingerProtectedMoveArea()
Protected multi pointer gesture area.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final float CIRCLE_PULSING_MAX_RADIUS_DEFAULT
public static final android.os.Parcelable.Creator<LocationComponentOptions> CREATOR
public LocationComponentOptions(float accuracyAlpha, int accuracyColor, int backgroundDrawableStale, @Nullable java.lang.String backgroundStaleName, int foregroundDrawableStale, @Nullable java.lang.String foregroundStaleName, int gpsDrawable, @Nullable java.lang.String gpsName, int foregroundDrawable, @Nullable java.lang.String foregroundName, int backgroundDrawable, @Nullable java.lang.String backgroundName, int bearingDrawable, @Nullable java.lang.String bearingName, @Nullable java.lang.Integer bearingTintColor, @Nullable java.lang.Integer foregroundTintColor, @Nullable java.lang.Integer backgroundTintColor, @Nullable java.lang.Integer foregroundStaleTintColor, @Nullable java.lang.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, java.lang.String layerAbove, java.lang.String layerBelow, float trackingAnimationDurationMultiplier, boolean compassAnimationEnabled, boolean accuracyAnimationEnabled, java.lang.Boolean pulseEnabled, java.lang.Boolean pulseFadeEnabled, java.lang.Integer pulseColor, float pulseSingleDuration, float pulseMaxRadius, float pulseAlpha, @Nullable android.view.animation.Interpolator pulseInterpolator)
protected LocationComponentOptions(android.os.Parcel in)
@NonNull public static LocationComponentOptions createFromAttributes(@NonNull android.content.Context context, @StyleRes int styleRes)
context
- your activity's context used for acquiring resourcesstyleRes
- the style id where your custom attributes are definedLocationComponentOptions
object with the settings you defined in your style
resource@NonNull public LocationComponentOptions.Builder toBuilder()
LocationComponentOptions
object 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.@NonNull public static LocationComponentOptions.Builder builder(@NonNull android.content.Context context)
LocationComponentOptions
class 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.context
- your activities context used to acquire the style resourcepublic float accuracyAlpha()
@ColorInt public int accuracyColor()
@DrawableRes public int backgroundDrawableStale()
@Nullable public java.lang.String backgroundStaleName()
Style.addImage(String, Bitmap)
, the
component, will use this image in place of the provided or default mapbox_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.
@DrawableRes public int foregroundDrawableStale()
@Nullable public java.lang.String foregroundStaleName()
Style.addImage(String, Bitmap)
, the
component, will used this image in place of the provided or default mapbox_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.
@DrawableRes public int gpsDrawable()
@Nullable public java.lang.String gpsName()
Style.addImage(String, Bitmap)
, the
component, will used this image in place of the provided or default mapbox_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.
@DrawableRes public int foregroundDrawable()
@Nullable public java.lang.String foregroundName()
Style.addImage(String, Bitmap)
, the
component, will used this image in place of the provided or default mapbox_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.
@DrawableRes public int backgroundDrawable()
@Nullable public java.lang.String backgroundName()
Style.addImage(String, Bitmap)
, the
component, will used this image in place of the provided or default mapbox_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.
@DrawableRes public int bearingDrawable()
@Nullable public java.lang.String bearingName()
Style.addImage(String, Bitmap)
, the
component, will used this image in place of the provided or default mapbox_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.
@ColorInt @Nullable public java.lang.Integer bearingTintColor()
@ColorInt @Nullable public java.lang.Integer foregroundTintColor()
@ColorInt @Nullable public java.lang.Integer backgroundTintColor()
@ColorInt @Nullable public java.lang.Integer foregroundStaleTintColor()
@ColorInt @Nullable public java.lang.Integer backgroundStaleTintColor()
@Dimension public float elevation()
public boolean enableStaleState()
public long staleStateTimeout()
@Nullable public int[] padding()
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.
public float maxZoomIconScale()
public float minZoomIconScale()
public boolean trackingGesturesManagement()
Note: If set to true, this can overwrite some of the gesture thresholds
and the custom AndroidGesturesManager
that was set with
MapboxMap.setGesturesManager(AndroidGesturesManager, boolean, boolean)
.
LocationComponentOptions.Builder.trackingInitialMoveThreshold(float)
,
LocationComponentOptions.Builder.trackingMultiFingerMoveThreshold(float)
,
LocationComponentOptions.Builder.trackingMultiFingerProtectedMoveArea(RectF)
public float trackingInitialMoveThreshold()
public float trackingMultiFingerMoveThreshold()
@Nullable public android.graphics.RectF trackingMultiFingerProtectedMoveArea()
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.
public java.lang.String layerAbove()
Style.addLayerAbove(Layer, String)
.
The component is going to placed directly above this layer.
public java.lang.String layerBelow()
Style.addLayerBelow(Layer, String)
.
The component is going to placed directly below this layer.
public float trackingAnimationDurationMultiplier()
public boolean compassAnimationEnabled()
CameraMode
and RenderMode
.public boolean accuracyAnimationEnabled()
public java.lang.Boolean pulseEnabled()
public java.lang.Boolean pulseFadeEnabled()
public java.lang.Integer pulseColor()
public float pulseSingleDuration()
public float pulseMaxRadius()
public float pulseAlpha()
@Nullable public android.view.animation.Interpolator pulseInterpolator()
@NonNull public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable