diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-09-19 10:56:47 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-09-22 23:33:56 +0300 |
commit | d1e69c8bafec2b799fae441be17b79c3566baac3 (patch) | |
tree | dc89c4d3dbe6125a10bee5721032febde4310a22 /platform | |
parent | 97a010cc9bde2eaa2cc94ca844fe9546347d37c2 (diff) | |
download | qtlocation-mapboxgl-d1e69c8bafec2b799fae441be17b79c3566baac3.tar.gz |
[android] CustomLayer - optionally accept a context lost callback function
Diffstat (limited to 'platform')
3 files changed, 16 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java index 7807556b78..f77e7280f0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java @@ -13,7 +13,16 @@ public class CustomLayer extends Layer { long initializeFunction, long renderFunction, long deinitializeFunction) { - initialize(id, initializeFunction, renderFunction, deinitializeFunction, context); + this(id, context, initializeFunction, renderFunction, 0L, deinitializeFunction); + } + + public CustomLayer(String id, + long context, + long initializeFunction, + long renderFunction, + long contextLostFunction, + long deinitializeFunction) { + initialize(id, initializeFunction, renderFunction, contextLostFunction, deinitializeFunction, context); } public CustomLayer(long nativePtr) { @@ -24,7 +33,8 @@ public class CustomLayer extends Layer { nativeUpdate(); } - protected native void initialize(String id, long initializeFunction, long renderFunction, long deinitializeFunction, + protected native void initialize(String id, long initializeFunction, long renderFunction, + long contextLostFunction, long deinitializeFunction, long context); protected native void nativeUpdate(); diff --git a/platform/android/src/style/layers/custom_layer.cpp b/platform/android/src/style/layers/custom_layer.cpp index e6321a8efa..51a48520bf 100644 --- a/platform/android/src/style/layers/custom_layer.cpp +++ b/platform/android/src/style/layers/custom_layer.cpp @@ -7,11 +7,12 @@ namespace mbgl { namespace android { - CustomLayer::CustomLayer(jni::JNIEnv& env, jni::String layerId, jni::jlong initializeFunction, jni::jlong renderFunction, jni::jlong deinitializeFunction, jni::jlong context) + CustomLayer::CustomLayer(jni::JNIEnv& env, jni::String layerId, jni::jlong initializeFunction, jni::jlong renderFunction, jni::jlong contextLostFunction, jni::jlong deinitializeFunction, jni::jlong context) : Layer(env, std::make_unique<mbgl::style::CustomLayer>( jni::Make<std::string>(env, layerId), reinterpret_cast<mbgl::style::CustomLayerInitializeFunction>(initializeFunction), reinterpret_cast<mbgl::style::CustomLayerRenderFunction>(renderFunction), + reinterpret_cast<mbgl::style::CustomLayerContextLostFunction>(contextLostFunction), reinterpret_cast<mbgl::style::CustomLayerDeinitializeFunction>(deinitializeFunction), reinterpret_cast<void*>(context)) ) { @@ -52,7 +53,7 @@ namespace android { // Register the peer jni::RegisterNativePeer<CustomLayer>( env, CustomLayer::javaClass, "nativePtr", - std::make_unique<CustomLayer, JNIEnv&, jni::String, jni::jlong, jni::jlong, jni::jlong, jni::jlong>, + std::make_unique<CustomLayer, JNIEnv&, jni::String, jni::jlong, jni::jlong, jni::jlong, jni::jlong, jni::jlong>, "initialize", "finalize", METHOD(&CustomLayer::update, "nativeUpdate")); diff --git a/platform/android/src/style/layers/custom_layer.hpp b/platform/android/src/style/layers/custom_layer.hpp index 3e3f3bf77f..9e079c1288 100644 --- a/platform/android/src/style/layers/custom_layer.hpp +++ b/platform/android/src/style/layers/custom_layer.hpp @@ -16,7 +16,7 @@ public: static void registerNative(jni::JNIEnv&); - CustomLayer(jni::JNIEnv&, jni::String, jni::jlong, jni::jlong, jni::jlong, jni::jlong); + CustomLayer(jni::JNIEnv&, jni::String, jni::jlong, jni::jlong, jni::jlong, jni::jlong, jni::jlong); CustomLayer(mbgl::Map&, mbgl::style::CustomLayer&); |