LocationComponentOptions

This class exposes options for the Location Component. The options can be set by defining a style in your apps style.xml file and passing in directly into the LocationPluginImpl 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 LocationPluginImpl activation method (if it isn't initialized yet) or applyStyle .

When the createFromAttributes 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 getLocationComponentOptions and it's {@code 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 applyStyle .

Deprecated

Use LocationComponentPlugin instead.

open class LocationComponentOptions : Parcelable

Constructors

LocationComponentOptions
Link copied to clipboard
open fun LocationComponentOptions(accuracyAlpha: Float, accuracyColor: Int, backgroundDrawableStale: Int, backgroundStaleName: String, foregroundDrawableStale: Int, foregroundStaleName: String, gpsDrawable: Int, gpsName: String, foregroundDrawable: Int, foregroundName: String, backgroundDrawable: Int, backgroundName: String, bearingDrawable: Int, bearingName: String, bearingTintColor: Integer, foregroundTintColor: Integer, backgroundTintColor: Integer, foregroundStaleTintColor: Integer, backgroundStaleTintColor: Integer, elevation: Float, enableStaleState: Boolean, staleStateTimeout: Long, padding: Array<Int>, maxZoomIconScale: Float, minZoomIconScale: Float, trackingGesturesManagement: Boolean, trackingInitialMoveThreshold: Float, trackingMultiFingerMoveThreshold: Float, trackingMultiFingerProtectedMoveArea: RectF, layerAbove: String, layerBelow: String, trackingAnimationDurationMultiplier: Float, compassAnimationEnabled: Boolean, accuracyAnimationEnabled: Boolean, pulseEnabled: Boolean, pulseFadeEnabled: Boolean, pulseColor: Integer, pulseSingleDuration: Float, pulseMaxRadius: Float, pulseAlpha: Float, pulseInterpolator: Interpolator)

Types

Builder
Link copied to clipboard

Builder class for constructing a new instance of LocationComponentOptions .

open class Builder

Functions

accuracyAlpha
Link copied to clipboard

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

open fun accuracyAlpha(): Float
accuracyAnimationEnabled
Link copied to clipboard

Enable or disable smooth animation of the accuracy circle around the user's position.

open fun accuracyAnimationEnabled(): Boolean
accuracyColor
Link copied to clipboard

Solid color to use as the accuracy view color property. References style attribute R.styleable#LocationComponent_accuracyColor

open fun accuracyColor(): Int
backgroundDrawable
Link copied to clipboard

Defines the drawable used for the background state icon. References style attribute R.styleable#LocationComponent_backgroundDrawable

open fun backgroundDrawable(): Int
backgroundDrawableStale
Link copied to clipboard

Defines the drawable used for the stale background icon. References style attribute R.styleable#LocationComponent_backgroundDrawableStale

open fun backgroundDrawableStale(): Int
backgroundName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun backgroundName(): String
backgroundStaleName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun backgroundStaleName(): String
backgroundStaleTintColor
Link copied to clipboard

Defines the background stale color as an integer. References style attribute R.styleable#LocationComponent_backgroundStaleTintColor

open fun backgroundStaleTintColor(): Integer
backgroundTintColor
Link copied to clipboard

Defines the background color as an integer. References style attribute R.styleable#LocationComponent_backgroundTintColor

open fun backgroundTintColor(): Integer
bearingDrawable
Link copied to clipboard

Defines the drawable used for the bearing icon. References style attribute R.styleable#LocationComponent_bearingDrawable

open fun bearingDrawable(): Int
bearingName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun bearingName(): String
bearingTintColor
Link copied to clipboard

Defines the bearing icon color as an integer. References style attribute R.styleable#LocationComponent_bearingTintColor

open fun bearingTintColor(): Integer
builder
Link copied to clipboard

Build a new instance of the 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.

open fun builder(context: Context): LocationComponentOptions.Builder
compassAnimationEnabled
Link copied to clipboard

Enable or disable smooth animation of compass values for com.mapbox.maps.plugin.location.modes.CameraMode and com.mapbox.maps.plugin.location.modes.RenderMode .

open fun compassAnimationEnabled(): Boolean
createFromAttributes
Link copied to clipboard

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.

open fun createFromAttributes(context: Context, styleRes: Int): LocationComponentOptions
describeContents
Link copied to clipboard
abstract fun describeContents(): Int

{@inheritDoc}

open fun describeContents(): Int
elevation
Link copied to clipboard

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

open fun elevation(): Float
enableStaleState
Link copied to clipboard

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

open fun enableStaleState(): Boolean
equals
Link copied to clipboard

{@inheritDoc}

open fun equals(o: Any): Boolean
foregroundDrawable
Link copied to clipboard

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

open fun foregroundDrawable(): Int
foregroundDrawableStale
Link copied to clipboard

Defines the drawable used for the stale foreground icon. References style attribute R.styleable#LocationComponent_foregroundDrawableStale

open fun foregroundDrawableStale(): Int
foregroundName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun foregroundName(): String
foregroundStaleName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun foregroundStaleName(): String
foregroundStaleTintColor
Link copied to clipboard

Defines the foreground stale color as an integer. References style attribute R.styleable#LocationComponent_foregroundStaleTintColor

open fun foregroundStaleTintColor(): Integer
foregroundTintColor
Link copied to clipboard

Defines the foreground color as an integer. References style attribute R.styleable#LocationComponent_foregroundTintColor

open fun foregroundTintColor(): Integer
gpsDrawable
Link copied to clipboard

Defines the drawable used for the navigation state icon. References style attribute R.styleable#LocationComponent_gpsDrawable

open fun gpsDrawable(): Int
gpsName
Link copied to clipboard

String image name, identical to one used in the first parameter of , 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.

open fun gpsName(): String
hashCode
Link copied to clipboard

{@inheritDoc}

open fun hashCode(): Int
layerAbove
Link copied to clipboard

Gets the id of the layer that's referenced when placing the component on the map using .

The component is going to placed directly above this layer.

open fun layerAbove(): String
layerBelow
Link copied to clipboard

Gets the id of the layer that's referenced when placing the component on the map using .

The component is going to placed directly below this layer.

open fun layerBelow(): String
maxZoomIconScale
Link copied to clipboard

The scale factor of the location icon when the map is zoomed in. Scaling is linear.

open fun maxZoomIconScale(): Float
minZoomIconScale
Link copied to clipboard

The scale factor of the location icon when the map is zoomed out. Scaling is linear.

open fun minZoomIconScale(): Float
padding
Link copied to clipboard

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.

open fun padding(): Array<Int>
pulseAlpha
Link copied to clipboard

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.

open fun pulseAlpha(): Float
pulseColor
Link copied to clipboard

Color of the LocationComponent's pulsing circle as it pulses.

open fun pulseColor(): Integer
pulseEnabled
Link copied to clipboard

Enable or disable the LocationComponent's pulsing circle.

open fun pulseEnabled(): Boolean
pulseFadeEnabled
Link copied to clipboard

Enable or disable fading of the LocationComponent's pulsing circle. If it fades, the circle's opacity decreases as its radius increases.

open fun pulseFadeEnabled(): Boolean
pulseInterpolator
Link copied to clipboard

The interpolator type of animation for the movement of the LocationComponent's circle

open fun pulseInterpolator(): Interpolator
pulseMaxRadius
Link copied to clipboard

The maximum radius that a single pulse should expand the LocationComponent's pulsing circle to.

open fun pulseMaxRadius(): Float
pulseSingleDuration
Link copied to clipboard

The number of milliseconds it takes for a single pulse of the LocationComponent's pulsing circle.

open fun pulseSingleDuration(): Float
staleStateTimeout
Link copied to clipboard

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

open fun staleStateTimeout(): Long
toBuilder
Link copied to clipboard

Takes the currently constructed 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.

open fun toBuilder(): LocationComponentOptions.Builder
toString
Link copied to clipboard

Convert object to string

open fun toString(): String
trackingAnimationDurationMultiplier
Link copied to clipboard

Get the tracking animation duration multiplier.

open fun trackingAnimationDurationMultiplier(): Float
trackingGesturesManagement
Link copied to clipboard

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 com.mapbox.android.gestures.AndroidGesturesManager that was set with .

open fun trackingGesturesManagement(): Boolean
trackingInitialMoveThreshold
Link copied to clipboard

Minimum single pointer movement in pixels required to break camera tracking.

open fun trackingInitialMoveThreshold(): Float
trackingMultiFingerMoveThreshold
Link copied to clipboard

Minimum multi pointer movement in pixels required to break camera tracking (for example during scale gesture).

open fun trackingMultiFingerMoveThreshold(): Float
trackingMultiFingerProtectedMoveArea
Link copied to clipboard

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 trackingMultiFingerMoveThreshold set to 0 or a relatively small value to not interfere with gestures outside of the defined rectangle.

open fun trackingMultiFingerProtectedMoveArea(): RectF
writeToParcel
Link copied to clipboard
abstract fun writeToParcel(p: Parcel, p1: Int)

{@inheritDoc}

open fun writeToParcel(dest: Parcel, flags: Int)

Properties

CIRCLE_PULSING_MAX_RADIUS_DEFAULT
Link copied to clipboard

Default maximum radius of the LocationComponent circle when it's pulsing.

val CIRCLE_PULSING_MAX_RADIUS_DEFAULT: Float
CREATOR
Link copied to clipboard

Creator for parcelable implementation.

val CREATOR: Parcelable.Creator<LocationComponentOptions>