summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2019-01-21 17:39:14 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-01-21 18:02:18 +0100
commit9604953d9080a4d79f72f60ce799ef05425b1ffc (patch)
tree5c0ffa2aa4cff73b662e68aec65447a8516e48ad
parenta4b814dd163fc653d305c2cbbc2eb4471ccdb34a (diff)
downloadqtlocation-mapboxgl-9604953d9080a4d79f72f60ce799ef05425b1ffc.tar.gz
[android] rename required TransitionOptions field
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt9
-rwxr-xr-xplatform/android/src/native_map_view.cpp2
-rw-r--r--platform/android/src/style/transition_options.cpp4
-rw-r--r--platform/android/src/style/transition_options.hpp2
4 files changed, 13 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
index 8bd5dafadd..40f74eae22 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
@@ -10,6 +10,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.geometry.ProjectedMeters
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer
+import com.mapbox.mapboxsdk.style.layers.TransitionOptions
import com.mapbox.mapboxsdk.testapp.utils.TestConstants
import junit.framework.Assert.assertEquals
import org.junit.Before
@@ -319,6 +320,14 @@ class NativeMapViewTest {
assertEquals("Zoom should match", expected.zoom, actual.zoom, TestConstants.ZOOM_DELTA)
}
+ @Test
+ @UiThreadTest
+ fun testTransitionOptions() {
+ val transitionOptions = TransitionOptions(500, 500)
+ nativeMapView.transitionOptions = transitionOptions
+ assertEquals(transitionOptions, nativeMapView.transitionOptions)
+ }
+
class DummyRenderer(context: Context) : MapRenderer(context, null) {
override fun requestRender() {
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 2216b260ce..405ecc5b76 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -688,7 +688,7 @@ jni::Local<jni::Object<TransitionOptions>> NativeMapView::getTransitionOptions(J
void NativeMapView::setTransitionOptions(JNIEnv& env, const jni::Object<TransitionOptions>& options) {
const mbgl::style::TransitionOptions transitionOptions(
Duration(mbgl::Milliseconds(TransitionOptions::getDuration(env, options))),
- Duration(mbgl::Milliseconds(TransitionOptions::getOffset(env, options)))
+ Duration(mbgl::Milliseconds(TransitionOptions::getDelay(env, options)))
);
map->getStyle().setTransitionOptions(transitionOptions);
}
diff --git a/platform/android/src/style/transition_options.cpp b/platform/android/src/style/transition_options.cpp
index 320f3d64b1..64de3fde8e 100644
--- a/platform/android/src/style/transition_options.cpp
+++ b/platform/android/src/style/transition_options.cpp
@@ -15,9 +15,9 @@ long TransitionOptions::getDuration(jni::JNIEnv& env, const jni::Object<Transiti
return transitionOptions.Get(env, field);
}
-long TransitionOptions::getOffset(jni::JNIEnv& env, const jni::Object<TransitionOptions>& transitionOptions) {
+long TransitionOptions::getDelay(jni::JNIEnv& env, const jni::Object<TransitionOptions>& transitionOptions) {
static auto& javaClass = jni::Class<TransitionOptions>::Singleton(env);
- static auto field = javaClass.GetField<jlong>(env, "offset");
+ static auto field = javaClass.GetField<jlong>(env, "delay");
return transitionOptions.Get(env, field);
}
diff --git a/platform/android/src/style/transition_options.hpp b/platform/android/src/style/transition_options.hpp
index cca56afdb6..5bd0fe9ee7 100644
--- a/platform/android/src/style/transition_options.hpp
+++ b/platform/android/src/style/transition_options.hpp
@@ -15,7 +15,7 @@ public:
static long getDuration(jni::JNIEnv&, const jni::Object<TransitionOptions>&);
- static long getOffset(jni::JNIEnv&, const jni::Object<TransitionOptions>&);
+ static long getDelay(jni::JNIEnv&, const jni::Object<TransitionOptions>&);
static void registerNative(jni::JNIEnv&);
};