diff options
author | Tobrun <tobrun@mapbox.com> | 2017-03-31 17:51:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-31 17:51:26 +0200 |
commit | 939526bac4aff734be4e6382b64c43214eb0bc9b (patch) | |
tree | b286e7b2b72b4776d2adfed628e0bebf38ec9710 /platform/android/src/style/layers/layer.cpp.ejs | |
parent | 05992c47aca0c83d5c0abc79c8e7833d69d24803 (diff) | |
download | qtlocation-mapboxgl-939526bac4aff734be4e6382b64c43214eb0bc9b.tar.gz |
[android] - transition options for layer properties (#8509)
[android] fixup highlevel bindings for transition options
finish integration
Diffstat (limited to 'platform/android/src/style/layers/layer.cpp.ejs')
-rw-r--r-- | platform/android/src/style/layers/layer.cpp.ejs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/platform/android/src/style/layers/layer.cpp.ejs b/platform/android/src/style/layers/layer.cpp.ejs index 5da397d77d..1debb096a3 100644 --- a/platform/android/src/style/layers/layer.cpp.ejs +++ b/platform/android/src/style/layers/layer.cpp.ejs @@ -9,6 +9,7 @@ #include <string> #include "../conversion/property_value.hpp" +#include "../conversion/transition_options.hpp" namespace mbgl { namespace android { @@ -53,7 +54,23 @@ namespace android { return jni::Object<jni::ObjectTag>(*converted); } +<% if (property.transition) { -%> + jni::Object<TransitionOptions> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(jni::JNIEnv& env) { + using namespace mbgl::android::conversion; + mbgl::style::TransitionOptions options = layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(); + return *convert<jni::Object<TransitionOptions>>(env, options); + } + + void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(jni::JNIEnv&, jlong duration, jlong delay) { + mbgl::style::TransitionOptions options; + options.duration.emplace(mbgl::Milliseconds(duration)); + options.delay.emplace(mbgl::Milliseconds(delay)); + layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(options); + } + +<% } -%> <% } -%> + jni::Class<<%- camelize(type) %>Layer> <%- camelize(type) %>Layer::javaClass; jni::jobject* <%- camelize(type) %>Layer::createJavaPeer(jni::JNIEnv& env) { @@ -77,8 +94,11 @@ namespace android { <% } -%> "initialize", "finalize",<% for(var i = 0; i < properties.length; i++) {%> - METHOD(&<%- camelize(type) %>Layer::get<%- camelize(properties[i].name) %>, "nativeGet<%- camelize(properties[i].name) %>")<% if(i != (properties.length -1)) {-%>,<% } -%> -<% } -%>); +<% if (properties[i].transition) { -%> + METHOD(&<%- camelize(type) %>Layer::get<%- camelize(properties[i].name) %>Transition, "nativeGet<%- camelize(properties[i].name) %>Transition"), + METHOD(&<%- camelize(type) %>Layer::set<%- camelize(properties[i].name) %>Transition, "nativeSet<%- camelize(properties[i].name) %>Transition"), +<% } -%> + METHOD(&<%- camelize(type) %>Layer::get<%- camelize(properties[i].name) %>, "nativeGet<%- camelize(properties[i].name) %>")<% if(i != (properties.length -1)) {-%>,<% } -%><% } -%>); } } // namespace android |