public class LocationComponentOptions extends Object
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 <any> |
CREATOR |
Constructor and Description |
---|
LocationComponentOptions(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,
double maxZoom,
double minZoom,
float maxZoomIconScale,
float minZoomIconScale,
boolean trackingGesturesManagement,
float trackingInitialMoveThreshold,
float trackingMultiFingerMoveThreshold,
String layerBelow,
float trackingAnimationDurationMultiplier) |
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.
|
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.
|
String |
backgroundName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_backgroundDrawable. |
String |
backgroundStaleName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will use this image in place of the provided or default mapbox_foregroundDrawableStale. |
Integer |
backgroundStaleTintColor()
Defines the background stale color as an integer.
|
Integer |
backgroundTintColor()
Defines the background color as an integer.
|
int |
bearingDrawable()
Defines the drawable used for the bearing icon.
|
String |
bearingName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_bearingDrawable. |
Integer |
bearingTintColor()
Defines the bearing icon color as an integer.
|
static LocationComponentOptions.Builder |
builder(Context context)
Build a new instance of the
LocationComponentOptions class with all the attributes set
automatically to their defined defaults in this library. |
static LocationComponentOptions |
createFromAttributes(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(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.
|
String |
foregroundName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_foregroundDrawable. |
String |
foregroundStaleName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_foregroundDrawableStale. |
Integer |
foregroundStaleTintColor()
Defines the foreground stale color as an integer.
|
Integer |
foregroundTintColor()
Defines the foreground color as an integer.
|
int |
gpsDrawable()
Defines the drawable used for the navigation state icon.
|
String |
gpsName()
String image name, identical to one used in
the first parameter of
MapboxMap.addImage(String, Bitmap) , the
component, will used this image in place of the provided or default mapbox_gpsDrawable. |
int |
hashCode() |
String |
layerBelow()
Gets the id of the layer to add the location component above to.
|
double |
maxZoom()
The maximum zoom level the map can be displayed at.
|
float |
maxZoomIconScale()
The scale factor of the location icon when the map is zoomed in.
|
double |
minZoom()
The minimum zoom level the map can be displayed at.
|
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.
|
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. |
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).
|
void |
writeToParcel(Parcel dest,
int flags) |
public LocationComponentOptions(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, double maxZoom, double minZoom, float maxZoomIconScale, float minZoomIconScale, boolean trackingGesturesManagement, float trackingInitialMoveThreshold, float trackingMultiFingerMoveThreshold, String layerBelow, float trackingAnimationDurationMultiplier)
public static LocationComponentOptions createFromAttributes(Context context, 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
resourcepublic 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.public static LocationComponentOptions.Builder builder(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()
public int accuracyColor()
public int backgroundDrawableStale()
public String backgroundStaleName()
MapboxMap.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.
public int foregroundDrawableStale()
public String foregroundStaleName()
MapboxMap.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.
public int gpsDrawable()
public String gpsName()
MapboxMap.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.
public int foregroundDrawable()
public String foregroundName()
MapboxMap.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.
public int backgroundDrawable()
public String backgroundName()
MapboxMap.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.
public int bearingDrawable()
public String bearingName()
MapboxMap.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.
public Integer bearingTintColor()
public Integer foregroundTintColor()
public Integer backgroundTintColor()
public Integer foregroundStaleTintColor()
public Integer backgroundStaleTintColor()
public float elevation()
public boolean enableStaleState()
public long staleStateTimeout()
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 double maxZoom()
public double minZoom()
public float maxZoomIconScale()
maxZoom()
.
Scaling is linear.public float minZoomIconScale()
minZoom()
.
Scaling is linear.public boolean trackingGesturesManagement()
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
MapboxMap.setGesturesManager(AndroidGesturesManager, boolean, boolean)
.
LocationComponentOptions.Builder.trackingInitialMoveThreshold(float)
,
LocationComponentOptions.Builder.trackingMultiFingerMoveThreshold(float)
public float trackingInitialMoveThreshold()
public float trackingMultiFingerMoveThreshold()
public String layerBelow()
public float trackingAnimationDurationMultiplier()
public void writeToParcel(Parcel dest, int flags)
public int describeContents()
© 2015–2018 Mapbox. All rights reserved.