Experimental API to toggle tile cache in map view (#2590)
This commit is contained in:
@@ -2504,4 +2504,18 @@ public final class MapLibreMap {
|
||||
listener.onDeveloperAnimationStarted();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Tile cache
|
||||
//
|
||||
|
||||
/**
|
||||
* Indicating whether the map may cache tiles for different zoom levels or not.
|
||||
*
|
||||
* @param enabled true causes the map view to consume more memory and have a smoother user
|
||||
* experience when zoom in/out. The default value of this property is `true`.
|
||||
*/
|
||||
public void experimental_setTileCacheEnabled(boolean enabled) {
|
||||
nativeMapView.setTileCacheEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ interface NativeMap {
|
||||
|
||||
void resizeView(int width, int height);
|
||||
|
||||
void setTileCacheEnabled(boolean enabled);
|
||||
|
||||
void onLowMemory();
|
||||
|
||||
void destroy();
|
||||
|
||||
@@ -619,6 +619,14 @@ final class NativeMapView implements NativeMap {
|
||||
nativeSetVisibleCoordinateBounds(coordinates, padding, direction, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTileCacheEnabled(boolean enabled) {
|
||||
if (checkState("setTileCacheEnabled")) {
|
||||
return;
|
||||
}
|
||||
nativeSetTileCacheEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
if (checkState("onLowMemory")) {
|
||||
@@ -1332,6 +1340,9 @@ final class NativeMapView implements NativeMap {
|
||||
private native void nativeSetVisibleCoordinateBounds(LatLng[] coordinates, RectF padding,
|
||||
double direction, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTileCacheEnabled(boolean enabled);
|
||||
|
||||
@Keep
|
||||
private native void nativeOnLowMemory();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user