Add runtime API for setting tile prefetch delta for Source class (#184)

* Add runtime API for setting tile prefetch delta for Source class

* Use Integer as param.

* Update gl native submodule.
This commit is contained in:
Kevin Li
2020-02-25 09:24:04 +08:00
committed by GitHub
parent 18264df98d
commit 2e9f02140c
3 changed files with 50 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ package com.mapbox.mapboxsdk.style.sources;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapbox.mapboxsdk.LibraryLoader;
import com.mapbox.mapboxsdk.utils.ThreadUtils;
@@ -68,6 +70,28 @@ public abstract class Source {
return nativeGetAttribution();
}
/**
* Retrieve current pre-fetching zoom delta.
*
* @return current zoom delta or null if not set.
*/
@Nullable
public Integer getPrefetchZoomDelta() {
return nativeGetPrefetchZoomDelta();
}
/**
* Set the tile pre-fetching zoom delta for current source. Pre-fetching makes sure that a low-resolution
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
* expense of a little bandwidth.
* If delta has not been set or set to null, it will use the value in MapboxMap instance.
*
* @param delta zoom delta
*/
public void setPrefetchZoomDelta(@Nullable Integer delta) {
nativeSetPrefetchZoomDelta(delta);
}
/**
* Internal use
*
@@ -85,6 +109,14 @@ public abstract class Source {
@Keep
protected native String nativeGetAttribution();
@NonNull
@Keep
protected native Integer nativeGetPrefetchZoomDelta();
@NonNull
@Keep
protected native void nativeSetPrefetchZoomDelta(Integer delta);
public void setDetached() {
detached = true;
}