diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline')
3 files changed, 66 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index ce498da8f5..1cf3711255 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -116,6 +116,12 @@ public class OfflineManager { }).start(); } + /** + * Get the single instance of offline manager. + * + * @param context the context used to host the offline manager + * @return the single instance of offline manager + */ public static synchronized OfflineManager getInstance(Context context) { if (instance == null) { instance = new OfflineManager(context); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java index fae53c2086..1b8c4121ef 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java @@ -394,6 +394,7 @@ public class OfflineRegion { * After you call this method, you may not call any additional methods on this object. * </p> * + * @param bytes the metadata in bytes * @param callback the callback to be invoked */ public void updateMetadata(@NonNull final byte[] bytes, @NonNull final OfflineRegionUpdateMetadataCallback callback) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java index 9c3655fbec..fe12dd46c4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java @@ -7,6 +7,7 @@ package com.mapbox.mapboxsdk.offline; * <p> * Note that the total required size in bytes is not currently available. A * future API release may provide an estimate of this number. + * </p> */ public class OfflineRegionStatus { @@ -51,6 +52,7 @@ public class OfflineRegionStatus { * Specifically, it is false during early phases of an offline download. Once * style and tile sources have been downloaded, it is possible to calculate the * precise number of required resources, at which point it is set to true. + * </p> */ private boolean requiredResourceCountIsPrecise = true; @@ -73,37 +75,93 @@ public class OfflineRegionStatus { } /** - * Is the region complete? + * Validates if the region download has completed + * + * @return true if download is complete, false if not */ public boolean isComplete() { return (completedResourceCount == requiredResourceCount); } + /** + * Returns the download state. + * <p> + * State is defined as + * </p> + * <ul> + * <li>{@link OfflineRegion#STATE_ACTIVE}</li> + * <li>{@link OfflineRegion#STATE_INACTIVE}</li> + * </ul> + * + * @return the download state. + */ @OfflineRegion.DownloadState public int getDownloadState() { return downloadState; } + /** + * Get the number of resources (inclusive of tiles) that have been fully downloaded + * and are ready for offline access. + * + * @return the amount of resources that have finished downloading. + */ public long getCompletedResourceCount() { return completedResourceCount; } + /** + * The cumulative size, in bytes, of all resources (inclusive of tiles) that have + * been fully downloaded. + * + * @return the size of the resources that have finished downloading + */ public long getCompletedResourceSize() { return completedResourceSize; } + /** + * Get the number of tiles that have been fully downloaded and are ready for + * offline access. + * + * @return the completed tile count + */ public long getCompletedTileCount() { return completedTileCount; } + /** + * Get the cumulative size, in bytes, of all tiles that have been fully downloaded. + * + * @return the completed tile size + */ public long getCompletedTileSize() { return completedTileSize; } + /** + * Get the number of resources that are known to be required for this region. See the + * documentation for `requiredResourceCountIsPrecise` for an important caveat + * about this number. + * + * @return the amount of resources that are required + */ public long getRequiredResourceCount() { return requiredResourceCount; } + /** + * Returns when the value of requiredResourceCount is a precise + * count of the number of required resources, and false when it is merely a lower + * bound. + * <p> + * Specifically, it is false during early phases of an offline download. Once + * style and tile sources have been downloaded, it is possible to calculate the + * precise number of required resources, at which point it is set to true. + * </p> + * + * @return True if the required resource count is precise, false if not + */ public boolean isRequiredResourceCountPrecise() { return requiredResourceCountIsPrecise; } |