// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. #include "background_layer.hpp" #include #include "../conversion/property_value.hpp" #include "../conversion/transition_options.hpp" namespace mbgl { namespace android { /** * Creates an owning peer object (for layers not attached to the map) from the JVM side */ BackgroundLayer::BackgroundLayer(jni::JNIEnv& env, jni::String& layerId) : Layer(env, std::make_unique(jni::Make(env, layerId))) { } /** * Creates a non-owning peer object (for layers currently attached to the map) */ BackgroundLayer::BackgroundLayer(mbgl::Map& map, mbgl::style::BackgroundLayer& coreLayer) : Layer(map, coreLayer) { } /** * Creates an owning peer object (for layers not attached to the map) */ BackgroundLayer::BackgroundLayer(mbgl::Map& map, std::unique_ptr coreLayer) : Layer(map, std::move(coreLayer)) { } BackgroundLayer::~BackgroundLayer() = default; // Property getters jni::Local> BackgroundLayer::getBackgroundColor(jni::JNIEnv& env) { using namespace mbgl::android::conversion; return std::move(*convert>>(env, layer.as()->BackgroundLayer::getBackgroundColor())); } jni::Local> BackgroundLayer::getBackgroundColorTransition(jni::JNIEnv& env) { using namespace mbgl::android::conversion; mbgl::style::TransitionOptions options = layer.as()->BackgroundLayer::getBackgroundColorTransition(); return std::move(*convert>>(env, options)); } void BackgroundLayer::setBackgroundColorTransition(jni::JNIEnv&, jlong duration, jlong delay) { mbgl::style::TransitionOptions options; options.duration.emplace(mbgl::Milliseconds(duration)); options.delay.emplace(mbgl::Milliseconds(delay)); layer.as()->BackgroundLayer::setBackgroundColorTransition(options); } jni::Local> BackgroundLayer::getBackgroundPattern(jni::JNIEnv& env) { using namespace mbgl::android::conversion; return std::move(*convert>>(env, layer.as()->BackgroundLayer::getBackgroundPattern())); } jni::Local> BackgroundLayer::getBackgroundPatternTransition(jni::JNIEnv& env) { using namespace mbgl::android::conversion; mbgl::style::TransitionOptions options = layer.as()->BackgroundLayer::getBackgroundPatternTransition(); return std::move(*convert>>(env, options)); } void BackgroundLayer::setBackgroundPatternTransition(jni::JNIEnv&, jlong duration, jlong delay) { mbgl::style::TransitionOptions options; options.duration.emplace(mbgl::Milliseconds(duration)); options.delay.emplace(mbgl::Milliseconds(delay)); layer.as()->BackgroundLayer::setBackgroundPatternTransition(options); } jni::Local> BackgroundLayer::getBackgroundOpacity(jni::JNIEnv& env) { using namespace mbgl::android::conversion; return std::move(*convert>>(env, layer.as()->BackgroundLayer::getBackgroundOpacity())); } jni::Local> BackgroundLayer::getBackgroundOpacityTransition(jni::JNIEnv& env) { using namespace mbgl::android::conversion; mbgl::style::TransitionOptions options = layer.as()->BackgroundLayer::getBackgroundOpacityTransition(); return std::move(*convert>>(env, options)); } void BackgroundLayer::setBackgroundOpacityTransition(jni::JNIEnv&, jlong duration, jlong delay) { mbgl::style::TransitionOptions options; options.duration.emplace(mbgl::Milliseconds(duration)); options.delay.emplace(mbgl::Milliseconds(delay)); layer.as()->BackgroundLayer::setBackgroundOpacityTransition(options); } jni::Local> BackgroundLayer::createJavaPeer(jni::JNIEnv& env) { static auto& javaClass = jni::Class::Singleton(env); static auto constructor = javaClass.GetConstructor(env); return javaClass.New(env, constructor, reinterpret_cast(this)); } void BackgroundLayer::registerNative(jni::JNIEnv& env) { // Lookup the class static auto& javaClass = jni::Class::Singleton(env); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod(name) // Register the peer jni::RegisterNativePeer( env, javaClass, "nativePtr", jni::MakePeer, "initialize", "finalize", METHOD(&BackgroundLayer::getBackgroundColorTransition, "nativeGetBackgroundColorTransition"), METHOD(&BackgroundLayer::setBackgroundColorTransition, "nativeSetBackgroundColorTransition"), METHOD(&BackgroundLayer::getBackgroundColor, "nativeGetBackgroundColor"), METHOD(&BackgroundLayer::getBackgroundPatternTransition, "nativeGetBackgroundPatternTransition"), METHOD(&BackgroundLayer::setBackgroundPatternTransition, "nativeSetBackgroundPatternTransition"), METHOD(&BackgroundLayer::getBackgroundPattern, "nativeGetBackgroundPattern"), METHOD(&BackgroundLayer::getBackgroundOpacityTransition, "nativeGetBackgroundOpacityTransition"), METHOD(&BackgroundLayer::setBackgroundOpacityTransition, "nativeSetBackgroundOpacityTransition"), METHOD(&BackgroundLayer::getBackgroundOpacity, "nativeGetBackgroundOpacity")); } } // namespace android } // namespace mbgl