diff options
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java | 13 | ||||
-rw-r--r-- | platform/android/config.cmake | 2 | ||||
-rwxr-xr-x | platform/android/src/jni.cpp | 2 | ||||
-rw-r--r-- | platform/android/src/style/style.cpp | 32 | ||||
-rw-r--r-- | platform/android/src/style/style.hpp | 33 |
5 files changed, 81 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java index 0ca7cf1c7b..032bd028bb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java @@ -20,6 +20,8 @@ import timber.log.Timber; public class Style { + private long nativePtr; + // todo remove NativeMapView facade private NativeMapView nativeMapView; @@ -28,7 +30,7 @@ public class Style { // todo make private Style() { - + initialize(); } // todo remove @@ -399,6 +401,15 @@ public class Style { } // + // Native methods + // + + private native void initialize(); + + @Override + protected native void finalize() throws Throwable; + + // // Constants // diff --git a/platform/android/config.cmake b/platform/android/config.cmake index f5de7a6052..596e0260ee 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -198,6 +198,8 @@ add_library(mbgl-android STATIC platform/android/src/style/position.hpp platform/android/src/style/light.cpp platform/android/src/style/light.hpp + platform/android/src/style/style.cpp + platform/android/src/style/style.hpp # FileSource holder platform/android/src/file_source.cpp diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 88ad0edb9e..19e6a42aa4 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -49,6 +49,7 @@ #include "style/layers/layers.hpp" #include "style/sources/source.hpp" #include "style/light.hpp" +#include "style/style.hpp" #include "snapshotter/map_snapshotter.hpp" #include "snapshotter/map_snapshot.hpp" #include "text/local_glyph_rasterizer_jni.hpp" @@ -170,6 +171,7 @@ void registerNatives(JavaVM *vm) { ExponentialStops::registerNative(env); IdentityStops::registerNative(env); IntervalStops::registerNative(env); + Style::registerNative(env); // Map CameraPosition::registerNative(env); diff --git a/platform/android/src/style/style.cpp b/platform/android/src/style/style.cpp new file mode 100644 index 0000000000..5e366e39a5 --- /dev/null +++ b/platform/android/src/style/style.cpp @@ -0,0 +1,32 @@ +#include "style.hpp" + +namespace mbgl { +namespace android { + +Style::Style(jni::JNIEnv &) { + +} + +Style::~Style() { +} + +jni::Class<Style> Style::javaClass; + +void Style::registerNative(jni::JNIEnv& env) { + //Register classes + Style::javaClass = *jni::Class<Style>::Find(env).NewGlobalRef(env).release(); + + #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) + + // Register the peer + jni::RegisterNativePeer<Style>( + env, Style::javaClass, "nativePtr", + std::make_unique<Style, JNIEnv&>, + "initialize", + "finalize" +); +} + + +} // namespace mbgl +} // namespace android
\ No newline at end of file diff --git a/platform/android/src/style/style.hpp b/platform/android/src/style/style.hpp new file mode 100644 index 0000000000..6c80c72bca --- /dev/null +++ b/platform/android/src/style/style.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include <mbgl/style/style.hpp> + +#include <jni/jni.hpp> + +namespace mbgl { +namespace android { + +/** + * Peer class for the Android Style holder. + */ +class Style { +public: + + // TODO move to style package + static constexpr auto Name() { return "com/mapbox/mapboxsdk/maps/Style"; }; + + Style(jni::JNIEnv &); + + ~Style(); + + static jni::Class<Style> javaClass; + + // TODO add methods + static void registerNative(jni::JNIEnv &); + +private: + +}; + +} +}
\ No newline at end of file |