diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java index 10dfff8694..f202d6267d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java @@ -82,25 +82,37 @@ public class LocationComponentOptions implements Parcelable { private float accuracyAlpha; private int accuracyColor; private int backgroundDrawableStale; + @Nullable private String backgroundStaleName; private int foregroundDrawableStale; + @Nullable private String foregroundStaleName; private int gpsDrawable; + @Nullable private String gpsName; private int foregroundDrawable; + @Nullable private String foregroundName; private int backgroundDrawable; + @Nullable private String backgroundName; private int bearingDrawable; + @Nullable private String bearingName; + @Nullable private Integer bearingTintColor; + @Nullable private Integer foregroundTintColor; + @Nullable private Integer backgroundTintColor; + @Nullable private Integer foregroundStaleTintColor; + @Nullable private Integer backgroundStaleTintColor; private float elevation; private boolean enableStaleState; private long staleStateTimeout; + @Nullable private int[] padding; private double maxZoom; private double minZoom; @@ -135,7 +147,7 @@ public class LocationComponentOptions implements Parcelable { float elevation, boolean enableStaleState, long staleStateTimeout, - int[] padding, + @Nullable int[] padding, double maxZoom, double minZoom, float maxZoomIconScale, @@ -192,6 +204,7 @@ public class LocationComponentOptions implements Parcelable { * @return a new {@link LocationComponentOptions} object with the settings you defined in your style * resource */ + @Nullable public static LocationComponentOptions createFromAttributes(@NonNull Context context, @StyleRes int styleRes) { @@ -316,6 +329,7 @@ public class LocationComponentOptions implements Parcelable { * * @return the builder which contains the values defined in this current instance as defaults. */ + @NonNull public Builder toBuilder() { return new Builder(this); } @@ -328,7 +342,8 @@ public class LocationComponentOptions implements Parcelable { * @param context your activities context used to acquire the style resource * @return the builder which contains the default values defined by the style resource */ - public static Builder builder(Context context) { + @NonNull + public static Builder builder(@NonNull Context context) { return LocationComponentOptions.createFromAttributes(context, R.style.mapbox_LocationComponent).toBuilder(); } @@ -626,6 +641,7 @@ public class LocationComponentOptions implements Parcelable { * * @return integer array of padding values */ + @Nullable @SuppressWarnings("mutable") public int[] padding() { return padding; @@ -723,6 +739,7 @@ public class LocationComponentOptions implements Parcelable { return trackingAnimationDurationMultiplier; } + @NonNull @Override public String toString() { return "LocationComponentOptions{" @@ -932,7 +949,7 @@ public class LocationComponentOptions implements Parcelable { }; @Override - public void writeToParcel(Parcel dest, int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeFloat(accuracyAlpha()); dest.writeInt(accuracyColor()); dest.writeInt(backgroundDrawableStale()); @@ -1055,25 +1072,37 @@ public class LocationComponentOptions implements Parcelable { private Float accuracyAlpha; private Integer accuracyColor; private Integer backgroundDrawableStale; + @Nullable private String backgroundStaleName; private Integer foregroundDrawableStale; + @Nullable private String foregroundStaleName; private Integer gpsDrawable; + @Nullable private String gpsName; private Integer foregroundDrawable; + @Nullable private String foregroundName; private Integer backgroundDrawable; + @Nullable private String backgroundName; private Integer bearingDrawable; + @Nullable private String bearingName; + @Nullable private Integer bearingTintColor; + @Nullable private Integer foregroundTintColor; + @Nullable private Integer backgroundTintColor; + @Nullable private Integer foregroundStaleTintColor; + @Nullable private Integer backgroundStaleTintColor; private Float elevation; private Boolean enableStaleState; private Long staleStateTimeout; + @Nullable private int[] padding; private Double maxZoom; private Double minZoom; @@ -1131,6 +1160,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_accuracyAlpha */ + @NonNull public LocationComponentOptions.Builder accuracyAlpha(float accuracyAlpha) { this.accuracyAlpha = accuracyAlpha; return this; @@ -1143,6 +1173,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_accuracyColor */ + @NonNull public LocationComponentOptions.Builder accuracyColor(int accuracyColor) { this.accuracyColor = accuracyColor; return this; @@ -1155,6 +1186,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_backgroundDrawableStale */ + @NonNull public LocationComponentOptions.Builder backgroundDrawableStale(int backgroundDrawableStale) { this.backgroundDrawableStale = backgroundDrawableStale; return this; @@ -1172,6 +1204,7 @@ public class LocationComponentOptions implements Parcelable { * @param backgroundStaleName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder backgroundStaleName(@Nullable String backgroundStaleName) { this.backgroundStaleName = backgroundStaleName; return this; @@ -1184,6 +1217,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_foregroundDrawableStale */ + @NonNull public LocationComponentOptions.Builder foregroundDrawableStale(int foregroundDrawableStale) { this.foregroundDrawableStale = foregroundDrawableStale; return this; @@ -1201,6 +1235,7 @@ public class LocationComponentOptions implements Parcelable { * @param foregroundStaleName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder foregroundStaleName(@Nullable String foregroundStaleName) { this.foregroundStaleName = foregroundStaleName; return this; @@ -1213,6 +1248,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_gpsDrawable */ + @NonNull public LocationComponentOptions.Builder gpsDrawable(int gpsDrawable) { this.gpsDrawable = gpsDrawable; return this; @@ -1230,6 +1266,7 @@ public class LocationComponentOptions implements Parcelable { * @param gpsName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder gpsName(@Nullable String gpsName) { this.gpsName = gpsName; return this; @@ -1242,6 +1279,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_foregroundDrawable */ + @NonNull public LocationComponentOptions.Builder foregroundDrawable(int foregroundDrawable) { this.foregroundDrawable = foregroundDrawable; return this; @@ -1259,6 +1297,7 @@ public class LocationComponentOptions implements Parcelable { * @param foregroundName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder foregroundName(@Nullable String foregroundName) { this.foregroundName = foregroundName; return this; @@ -1271,6 +1310,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_backgroundDrawable */ + @NonNull public LocationComponentOptions.Builder backgroundDrawable(int backgroundDrawable) { this.backgroundDrawable = backgroundDrawable; return this; @@ -1288,6 +1328,7 @@ public class LocationComponentOptions implements Parcelable { * @param backgroundName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder backgroundName(@Nullable String backgroundName) { this.backgroundName = backgroundName; return this; @@ -1300,6 +1341,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_bearingDrawable */ + @NonNull public LocationComponentOptions.Builder bearingDrawable(int bearingDrawable) { this.bearingDrawable = bearingDrawable; return this; @@ -1317,6 +1359,7 @@ public class LocationComponentOptions implements Parcelable { * @param bearingName String icon or maki-icon name * @return this builder for chaining options together */ + @NonNull public LocationComponentOptions.Builder bearingName(@Nullable String bearingName) { this.bearingName = bearingName; return this; @@ -1329,6 +1372,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_bearingTintColor */ + @NonNull public LocationComponentOptions.Builder bearingTintColor(@Nullable Integer bearingTintColor) { this.bearingTintColor = bearingTintColor; return this; @@ -1341,6 +1385,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_foregroundTintColor */ + @NonNull public LocationComponentOptions.Builder foregroundTintColor(@Nullable Integer foregroundTintColor) { this.foregroundTintColor = foregroundTintColor; return this; @@ -1353,6 +1398,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_backgroundTintColor */ + @NonNull public LocationComponentOptions.Builder backgroundTintColor(@Nullable Integer backgroundTintColor) { this.backgroundTintColor = backgroundTintColor; return this; @@ -1365,6 +1411,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_foregroundStaleTintColor */ + @NonNull public LocationComponentOptions.Builder foregroundStaleTintColor(@Nullable Integer foregroundStaleTintColor) { this.foregroundStaleTintColor = foregroundStaleTintColor; return this; @@ -1377,6 +1424,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_backgroundStaleTintColor */ + @NonNull public LocationComponentOptions.Builder backgroundStaleTintColor(@Nullable Integer backgroundStaleTintColor) { this.backgroundStaleTintColor = backgroundStaleTintColor; return this; @@ -1389,6 +1437,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_elevation */ + @NonNull public LocationComponentOptions.Builder elevation(float elevation) { this.elevation = elevation; return this; @@ -1402,6 +1451,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_enableStaleState */ + @NonNull public LocationComponentOptions.Builder enableStaleState(boolean enabled) { this.enableStaleState = enabled; return this; @@ -1417,6 +1467,7 @@ public class LocationComponentOptions implements Parcelable { * @return this builder for chaining options together * @attr ref R.styleable#LocationComponent_staleStateTimeout */ + @NonNull public LocationComponentOptions.Builder staleStateTimeout(long timeout) { this.staleStateTimeout = timeout; return this; @@ -1436,7 +1487,8 @@ public class LocationComponentOptions implements Parcelable { * * @param padding The margins for the map in pixels (left, top, right, bottom). */ - public LocationComponentOptions.Builder padding(int[] padding) { + @NonNull + public LocationComponentOptions.Builder padding(@Nullable int[] padding) { if (padding == null) { throw new NullPointerException("Null padding"); } @@ -1451,6 +1503,7 @@ public class LocationComponentOptions implements Parcelable { * * @param maxZoom The new maximum zoom level. */ + @NonNull public LocationComponentOptions.Builder maxZoom(double maxZoom) { this.maxZoom = maxZoom; return this; @@ -1461,6 +1514,7 @@ public class LocationComponentOptions implements Parcelable { * * @param minZoom The new minimum zoom level. */ + @NonNull public LocationComponentOptions.Builder minZoom(double minZoom) { this.minZoom = minZoom; return this; @@ -1475,6 +1529,7 @@ public class LocationComponentOptions implements Parcelable { * * @param maxZoomIconScale icon scale factor */ + @NonNull public LocationComponentOptions.Builder maxZoomIconScale(float maxZoomIconScale) { this.maxZoomIconScale = maxZoomIconScale; return this; @@ -1489,6 +1544,7 @@ public class LocationComponentOptions implements Parcelable { * * @param minZoomIconScale icon scale factor */ + @NonNull public LocationComponentOptions.Builder minZoomIconScale(float minZoomIconScale) { this.minZoomIconScale = minZoomIconScale; return this; @@ -1508,6 +1564,7 @@ public class LocationComponentOptions implements Parcelable { * @see Builder#trackingInitialMoveThreshold(float) * @see Builder#trackingMultiFingerMoveThreshold(float) */ + @NonNull public LocationComponentOptions.Builder trackingGesturesManagement(boolean trackingGesturesManagement) { this.trackingGesturesManagement = trackingGesturesManagement; return this; @@ -1518,6 +1575,7 @@ public class LocationComponentOptions implements Parcelable { * * @param moveThreshold the minimum movement */ + @NonNull public LocationComponentOptions.Builder trackingInitialMoveThreshold(float moveThreshold) { this.trackingInitialMoveThreshold = moveThreshold; return this; @@ -1529,6 +1587,7 @@ public class LocationComponentOptions implements Parcelable { * * @param moveThreshold the minimum movement */ + @NonNull public LocationComponentOptions.Builder trackingMultiFingerMoveThreshold(float moveThreshold) { this.trackingMultiFingerMoveThreshold = moveThreshold; return this; @@ -1539,6 +1598,7 @@ public class LocationComponentOptions implements Parcelable { * * @param layerBelow the id to set the location component below to. */ + @NonNull public LocationComponentOptions.Builder layerBelow(String layerBelow) { this.layerBelow = layerBelow; return this; @@ -1550,6 +1610,7 @@ public class LocationComponentOptions implements Parcelable { * @param trackingAnimationDurationMultiplier the tracking animation duration multiplier * @since 0.9.0 */ + @NonNull public LocationComponentOptions.Builder trackingAnimationDurationMultiplier( float trackingAnimationDurationMultiplier) { this.trackingAnimationDurationMultiplier = trackingAnimationDurationMultiplier; |