diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 8098ee4d86e..f75d7ed90d6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk; +import android.app.Application; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -15,6 +16,14 @@ import com.mapbox.services.android.telemetry.location.LocationEngine; import com.mapbox.services.android.telemetry.location.LocationEnginePriority; +/** + * The entry point of the Mapbox Android SDK. + *
+ * Obtain a reference by calling {@link #getInstance(Context, String)}. Usually this class is configured in + * {@link Application#onCreate()} and is responsible for the active access token, application context, and + * connectivity state. + *
+ */ public final class Mapbox { private static Mapbox INSTANCE; @@ -25,7 +34,7 @@ public final class Mapbox { /** * Get an instance of Mapbox. *- * This class manages the active access token, application context and connectivity state. + * This class manages the active access token, application context, and connectivity state. *
* * @param context Android context which holds or is an application context @@ -52,9 +61,9 @@ public static synchronized Mapbox getInstance(@NonNull Context context, @NonNull } /** - * Access Token for this application. + * Access token for this application. * - * @return Mapbox Access Token + * @return Mapbox access token */ public static String getAccessToken() { validateMapbox(); @@ -72,12 +81,14 @@ private static void validateMapbox() throws MapboxConfigurationException { } /** - * Runtime validation of Access Token. + * Runtime validation of access token. * * @throws MapboxConfigurationException exception thrown when not using a valid accessToken */ private static void validateAccessToken() throws MapboxConfigurationException { - String accessToken = INSTANCE.accessToken; + String + + = INSTANCE.accessToken; if (TextUtils.isEmpty(accessToken) || (!accessToken.toLowerCase(MapboxConstants.MAPBOX_LOCALE).startsWith("pk.") && !accessToken.toLowerCase(MapboxConstants.MAPBOX_LOCALE).startsWith("sk."))) { throw new MapboxConfigurationException(); @@ -92,11 +103,11 @@ public static Context getApplicationContext() { } /** - * Manually sets the connectivity state of the app. This is useful for apps that control their + * Manually sets the connectivity state of the app. This is useful for apps which control their * own connectivity state and want to bypass any checks to the ConnectivityManager. * * @param connected flag to determine the connectivity state, true for connected, false for - * disconnected, null for ConnectivityManager to determine. + * disconnected, and null for ConnectivityManager to determine. */ public static synchronized void setConnected(Boolean connected) { // Connectivity state overridden by app @@ -104,10 +115,10 @@ public static synchronized void setConnected(Boolean connected) { } /** - * Determines whether we have an Internet connection available. Please do not rely on this - * method in your apps, this method is used internally by the SDK. + * Determines whether we have an internet connection available. Please do not rely on this + * method in your apps. This method is used internally by the SDK. * - * @return true if there is an Internet connection, false otherwise + * @return true if there is an internet connection, false otherwise */ public static synchronized Boolean isConnected() { if (INSTANCE.connected != null) { @@ -119,4 +130,4 @@ public static synchronized Boolean isConnected() { NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return (activeNetwork != null && activeNetwork.isConnected()); } -} \ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index 5e958ff5651..66c261f1d0b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -156,7 +156,7 @@ public int hashCode() { } /** - * Builder for composing {@link CameraPosition} objects. + * Builder for composing CameraPosition objects. */ public static final class Builder { @@ -190,7 +190,7 @@ public Builder(CameraPosition previous) { /** * Create Builder with an existing CameraPosition data. * - * @param typedArray TypedArray containgin attribute values + * @param typedArray TypedArray containing attribute values */ public Builder(TypedArray typedArray) { super(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 64b86054a0c..8e1411e2739 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -15,7 +15,7 @@ import java.lang.annotation.RetentionPolicy; /** - * Factory for creating {@link CameraUpdate} objects. + * Factory for creating CameraUpdate objects. */ public final class CameraUpdateFactory { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java index f53c65d055a..88c3bef6733 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java @@ -16,7 +16,7 @@ public class MyBearingTracking { /** - * Indicates the parameter accepts one of the values from {@link MyBearingTracking}. + * Indicates that the parameter accepts one of the values from MyBearingTracking. */ @IntDef( {NONE, COMPASS, GPS, /**COMBINED**/}) @Retention(RetentionPolicy.SOURCE) @@ -38,6 +38,4 @@ public class MyBearingTracking { */ public static final int GPS = 0x00000008; - // public static final int COMBINED = 0x00000012; - } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java index 39f653596f6..a1744d701f2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java @@ -17,7 +17,7 @@ public class MyLocationTracking { /** - * Indicates the parameter accepts one of the values from {@link MyLocationTracking}. + * Indicates the parameter accepts one of the values from MyLocationTracking. */ @IntDef( {TRACKING_NONE, TRACKING_FOLLOW}) @Retention(RetentionPolicy.SOURCE) @@ -30,7 +30,7 @@ public class MyLocationTracking { public static final int TRACKING_NONE = 0x00000000; /** - * Tracking the location of the user, {@link MapView} will reposition to center of {@link MyLocationView} + * Tracking the location of the user. {@link MapView} will reposition to center of {@link MyLocationView} */ public static final int TRACKING_FOLLOW = 0x00000004; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java index 77d0929df3e..31e6313509c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java @@ -19,7 +19,7 @@ public class Style { /** - * Indicates the parameter accepts one of the values from {@link Style}. Using one of these + * Indicates the parameter accepts one of the values from Style. Using one of these * constants means your map style will always use the latest version and may change as we * improve the style */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java index c4bdb4a17de..4e934fa3ccb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java @@ -2,7 +2,7 @@ import android.content.Context; import android.location.Location; -import android.util.Log; +import android.support.annotation.NonNull; import com.mapbox.services.android.telemetry.location.LocationEngine; import com.mapbox.services.android.telemetry.location.LocationEngineListener; @@ -15,6 +15,8 @@ import java.lang.ref.WeakReference; +import timber.log.Timber; + /** * Manages locational updates. Contains methods to register and unregister location listeners. ** Composite functions allow the appearance of a map feature to change with both its * properties and zoom. Each stop is an array with two elements, the first is an object diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java index 643a126388b..4dbb461e4ca 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java @@ -11,7 +11,7 @@ public class Filter { /** - * Base {@link Filter} statement. Subclassed to provide concrete statements. + * Base Filter statement. Subclassed to provide concrete statements. */ public abstract static class Statement { protected final String operator; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java index a46c11b35cd..6e6e4ca6138 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java @@ -1,23 +1,51 @@ package com.mapbox.mapboxsdk.style.layers; +/** + * Resembles transition property from the style specification. + * + * @see Transition documentation + */ public class TransitionOptions { private long duration; private long delay; + /** + * Create a transition property based on duration and a delay. + * + * @param duration the duration of the transition + * @param delay the delay to start the transition + */ public TransitionOptions(long duration, long delay) { this.duration = duration; this.delay = delay; } + /** + * Create a transition property based on duration and a delay. + * + * @param duration the duration of the transition + * @param delay the delay to start the transition + * @return a new transition property object + */ public static TransitionOptions fromTransitionOptions(long duration, long delay) { return new TransitionOptions(duration, delay); } + /** + * Get the transition duration. + * + * @return the transition duration + */ public long getDuration() { return duration; } + /** + * Get the transition delay. + * + * @return the transition delay + */ public long getDelay() { return delay; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/package-info.java new file mode 100644 index 00000000000..a613bf9587b --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Style Light API classes. + */ +package com.mapbox.mapboxsdk.style.light; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/AnimatorUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/AnimatorUtils.java index 7694604d9fd..34c52c829bc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/AnimatorUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/AnimatorUtils.java @@ -10,13 +10,31 @@ import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.view.View; +/** + * Animator utility class. + */ public class AnimatorUtils { + /** + * Animate a view from an animator resource. + * + * @param view the view to be animated + * @param animatorRes the animator resource to be loaded + * @param listener the animator end listener + */ public static void animate(@NonNull final View view, @AnimatorRes int animatorRes, @Nullable OnAnimationEndListener listener) { animate(view, animatorRes, -1, listener); } + /** + * Animate a view from an animator resource. + * + * @param view the view to be animated + * @param animatorRes the animator resource to be loaded + * @param duration the duration of the animator + * @param listener the animator end listener + */ public static void animate(final View view, @AnimatorRes int animatorRes, int duration, @Nullable final OnAnimationEndListener listener) { if (view == null) { @@ -43,14 +61,33 @@ public void onAnimationEnd(Animator animation) { animator.start(); } + /** + * Animate a view from an animator resource. + * + * @param view the view to be animated + * @param animatorRes the animator resource to be loaded + */ public static void animate(@NonNull final View view, @AnimatorRes int animatorRes) { animate(view, animatorRes, -1); } + /** + * Animate a view from an animator resource. + * + * @param view the view to be animated + * @param animatorRes the animator resource to be loaded + * @param duration the duration of the animator + */ public static void animate(@NonNull final View view, @AnimatorRes int animatorRes, int duration) { animate(view, animatorRes, duration, null); } + /** + * Animate a view rotation property to a value. + * + * @param view the view to be rotated + * @param rotation the value to animate to + */ public static void rotate(@NonNull final View view, float rotation) { view.setLayerType(View.LAYER_TYPE_HARDWARE, null); ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(view, View.ROTATION, view.getRotation(), rotation); @@ -64,6 +101,12 @@ public void onAnimationEnd(Animator animation) { rotateAnimator.start(); } + /** + * Animate a view rotation property by a value. + * + * @param view the view to be rotated + * @param rotationBy the value to animate by + */ public static void rotateBy(@NonNull final View view, float rotationBy) { view.setLayerType(View.LAYER_TYPE_HARDWARE, null); view.animate().rotationBy(rotationBy).setInterpolator(new FastOutSlowInInterpolator()).setListener( @@ -76,6 +119,13 @@ public void onAnimationEnd(Animator animation) { }); } + /** + * Animate a view alpha property to a value. + * + * @param convertView the view to be animated + * @param alpha the value to animate to + * @param listener the animator end listener + */ public static void alpha(@NonNull final View convertView, float alpha, @Nullable final OnAnimationEndListener listener) { convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null); @@ -99,10 +149,19 @@ public void onAnimationEnd(Animator animation) { rotateAnimator.start(); } + /** + * Animate a view alpha property to a value. + * + * @param convertView the view to be animated + * @param alpha the value to animate to + */ public static void alpha(@NonNull final View convertView, float alpha) { alpha(convertView, alpha, null); } + /** + * An interface definition that is invoked when an animation ends. + */ public interface OnAnimationEndListener { void onAnimationEnd(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java index 2da2472d69a..24c76243d96 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java @@ -17,6 +17,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * Color utility class. + */ public class ColorUtils { /**