From ef6a8fbc34c39cc4b28ec4f9c5b655d1f2478c9b Mon Sep 17 00:00:00 2001 From: Antonio Zugaldia Date: Thu, 25 Feb 2016 10:29:24 -0500 Subject: [PATCH] [android] #3891 - handle requiredResourceCountIsIndeterminate -> requiredResourceCountIsPrecise rename --- .../mapboxsdk/offline/OfflineRegionStatus.java | 15 ++++++++------- platform/android/src/jni.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) 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 107bed6cf6a..e65a20f18ed 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 @@ -25,20 +25,21 @@ public class OfflineRegionStatus { /** * The number of resources that are known to be required for this region. See the - * documentation for `requiredResourceCountIsIndeterminate` for an important caveat + * documentation for `requiredResourceCountIsPrecise` for an important caveat * about this number. */ private long requiredResourceCount = 0; /** - * This property is true during early phases of an offline download, when the total - * required resource count is unknown and requiredResourceCount is merely a lower + * This property is true when the value of requiredResourceCount is a precise + * count of the number of required resources, and false when it is merely a lower * bound. * - * Specifically, it is true before until the style and tile sources have been - * downloaded, and false thereafter. + * 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. */ - private boolean requiredResourceCountIsIndeterminate = true; + private boolean requiredResourceCountIsPrecise = true; /* * Use setObserver(OfflineRegionObserver observer) to obtain a OfflineRegionStatus object. @@ -77,7 +78,7 @@ public long getRequiredResourceCount() { } public boolean isRequiredResourceCountPrecise() { - return !requiredResourceCountIsIndeterminate; + return requiredResourceCountIsPrecise; } } diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 40b9bfe2517..35b9cb76332 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -159,7 +159,7 @@ jfieldID offlineRegionStatusDownloadStateId = nullptr; jfieldID offlineRegionStatusCompletedResourceCountId = nullptr; jfieldID offlineRegionStatusCompletedResourceSizeId = nullptr; jfieldID offlineRegionStatusRequiredResourceCountId = nullptr; -jfieldID offlineRegionStatusRequiredResourceCountIsIndeterminateId = nullptr; +jfieldID offlineRegionStatusRequiredResourceCountIsPreciseId = nullptr; jclass offlineRegionErrorClass = nullptr; jmethodID offlineRegionErrorConstructorId = nullptr; @@ -1907,7 +1907,7 @@ void JNICALL setOfflineRegionObserver(JNIEnv *env, jobject obj, jobject offlineR env2->SetLongField(jstatus, offlineRegionStatusCompletedResourceCountId, status.completedResourceCount); env2->SetLongField(jstatus, offlineRegionStatusCompletedResourceSizeId, status.completedResourceSize); env2->SetLongField(jstatus, offlineRegionStatusRequiredResourceCountId, status.requiredResourceCount); - env2->SetBooleanField(jstatus, offlineRegionStatusRequiredResourceCountIsIndeterminateId, status.requiredResourceCountIsIndeterminate); + env2->SetBooleanField(jstatus, offlineRegionStatusRequiredResourceCountIsPreciseId, status.requiredResourceCountIsPrecise); env2->CallVoidMethod(observerCallback, offlineRegionObserveronStatusChangedId, jstatus); // Delete global refs and detach when we're done @@ -2014,7 +2014,7 @@ void JNICALL getOfflineRegionStatus(JNIEnv *env, jobject obj, jobject offlineReg env2->SetLongField(jstatus, offlineRegionStatusCompletedResourceCountId, status->completedResourceCount); env2->SetLongField(jstatus, offlineRegionStatusCompletedResourceSizeId, status->completedResourceSize); env2->SetLongField(jstatus, offlineRegionStatusRequiredResourceCountId, status->requiredResourceCount); - env2->SetBooleanField(jstatus, offlineRegionStatusRequiredResourceCountIsIndeterminateId, status->requiredResourceCountIsIndeterminate); + env2->SetBooleanField(jstatus, offlineRegionStatusRequiredResourceCountIsPreciseId, status->requiredResourceCountIsPrecise); env2->CallVoidMethod(statusCallback, offlineRegionStatusOnStatusId, jstatus); } @@ -2667,8 +2667,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } - offlineRegionStatusRequiredResourceCountIsIndeterminateId = env->GetFieldID(offlineRegionStatusClass, "requiredResourceCountIsIndeterminate", "Z"); - if (offlineRegionStatusRequiredResourceCountIsIndeterminateId == nullptr) { + offlineRegionStatusRequiredResourceCountIsPreciseId = env->GetFieldID(offlineRegionStatusClass, "requiredResourceCountIsPrecise", "Z"); + if (offlineRegionStatusRequiredResourceCountIsPreciseId == nullptr) { env->ExceptionDescribe(); return JNI_ERR; } @@ -3478,7 +3478,7 @@ extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { offlineRegionStatusCompletedResourceCountId = nullptr; offlineRegionStatusCompletedResourceSizeId = nullptr; offlineRegionStatusRequiredResourceCountId = nullptr; - offlineRegionStatusRequiredResourceCountIsIndeterminateId = nullptr; + offlineRegionStatusRequiredResourceCountIsPreciseId = nullptr; env->DeleteGlobalRef(offlineRegionErrorClass); offlineRegionErrorConstructorId = nullptr;