summaryrefslogtreecommitdiff
path: root/platform/android/src/style/sources/raster_source.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-08-17 13:43:07 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-09-07 09:44:12 -0700
commit53c3c327f0ebea276d977f58a59cdb9449165518 (patch)
tree1315a80a1c24f24dd1cbd4e00cf85083be16ce45 /platform/android/src/style/sources/raster_source.cpp
parent6806ba5b52129050c0944bd7c8b1fe285baeeddc (diff)
downloadqtlocation-mapboxgl-53c3c327f0ebea276d977f58a59cdb9449165518.tar.gz
[android] Upgrade to latest jni.hpp
Diffstat (limited to 'platform/android/src/style/sources/raster_source.cpp')
-rw-r--r--platform/android/src/style/sources/raster_source.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/android/src/style/sources/raster_source.cpp b/platform/android/src/style/sources/raster_source.cpp
index 33223a5b69..4eef41c8b1 100644
--- a/platform/android/src/style/sources/raster_source.cpp
+++ b/platform/android/src/style/sources/raster_source.cpp
@@ -16,7 +16,7 @@ namespace android {
env,
std::make_unique<mbgl::style::RasterSource>(
jni::Make<std::string>(env, sourceId),
- convertURLOrTileset(Value(env, urlOrTileSet)),
+ convertURLOrTileset(Value(env, jni::SeizeLocal(env, std::move(urlOrTileSet)))),
tileSize
)
) {
@@ -35,22 +35,21 @@ namespace android {
return url ? jni::Make<jni::String>(env, *url) : jni::String();
}
- jni::Class<RasterSource> RasterSource::javaClass;
-
jni::Object<Source> RasterSource::createJavaPeer(jni::JNIEnv& env) {
- static auto constructor = RasterSource::javaClass.template GetConstructor<jni::jlong>(env);
- return jni::Object<Source>(RasterSource::javaClass.New(env, constructor, reinterpret_cast<jni::jlong>(this)).Get());
+ static auto javaClass = jni::Class<RasterSource>::Singleton(env);
+ static auto constructor = javaClass.GetConstructor<jni::jlong>(env);
+ return jni::Object<Source>(javaClass.New(env, constructor, reinterpret_cast<jni::jlong>(this)).Get());
}
void RasterSource::registerNative(jni::JNIEnv& env) {
// Lookup the class
- RasterSource::javaClass = *jni::Class<RasterSource>::Find(env).NewGlobalRef(env).release();
+ static auto javaClass = jni::Class<RasterSource>::Singleton(env);
#define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name)
// Register the peer
jni::RegisterNativePeer<RasterSource>(
- env, RasterSource::javaClass, "nativePtr",
+ env, javaClass, "nativePtr",
std::make_unique<RasterSource, JNIEnv&, jni::String, jni::Object<>, jni::jint>,
"initialize",
"finalize",