diff options
Diffstat (limited to 'android')
5 files changed, 27 insertions, 29 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index f04ed94b3f..7b905598cf 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -434,8 +434,8 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration)); } -void JNICALL nativeAddAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddAnnotation"); +void JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddMarker"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); @@ -997,8 +997,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeMoveBy", "(JDDJ)V", reinterpret_cast<void *>(&nativeMoveBy)}, {"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V", reinterpret_cast<void *>(&nativeSetLatLng)}, - {"nativeAddAnnotation", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", - reinterpret_cast<void *>(&nativeAddAnnotation)}, + {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", + reinterpret_cast<void *>(&nativeAddMarker)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast<void *>(&nativeGetLatLng)}, {"nativeResetPosition", "(J)V", reinterpret_cast<void *>(&nativeResetPosition)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index 06807dfa04..6af2e3e60c 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -26,7 +26,6 @@ import android.view.SurfaceView; import android.view.View; import android.view.ViewConfiguration; import android.widget.ZoomButtonsController; -import android.util.Log; import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; @@ -205,8 +204,8 @@ public class MapView extends SurfaceView { } } - public void addAnnotation(LatLng marker) { - mNativeMapView.addAnnotation(marker); + public void addMarker(LatLng marker) { + mNativeMapView.addMarker(marker); } // diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index ad86665060..c1969c9618 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxgl.views; import android.graphics.PointF; import android.view.Surface; -import android.util.Log; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; @@ -214,8 +213,8 @@ class NativeMapView { nativeSetLatLng(mNativeMapViewPtr, latLng, duration); } - public void addAnnotation(LatLng latLng) { - nativeAddAnnotation(mNativeMapViewPtr, latLng); + public void addMarker(LatLng latLng) { + nativeAddMarker(mNativeMapViewPtr, latLng); } public LatLng getLatLng() { @@ -450,7 +449,7 @@ class NativeMapView { private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, long duration); - private native void nativeAddAnnotation(long nativeMapViewPtr, LatLng latLng); + private native void nativeAddMarker(long nativeMapViewPtr, LatLng latLng); private native LatLng nativeGetLatLng(long nativeMapViewPtr); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 8bef3392c6..34fe4f02f1 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -77,8 +77,8 @@ public class MainActivity extends ActionBarActivity { private float mCompassBearing; private boolean mCompassValid = false; - // Used for point annotations - private boolean mIsPointAnnotationsOn = false; + // Used for markers + private boolean mIsMarkersOn = false; // // Lifecycle events @@ -213,9 +213,9 @@ public class MainActivity extends ActionBarActivity { } return true; - case R.id.action_point_annotations: - // Toggle point annotations - togglePointAnnotations(!mIsPointAnnotationsOn); + case R.id.action_markers: + // Toggle markers + toggleMarkers(!mIsMarkersOn); default: return super.onOptionsItemSelected(item); @@ -257,29 +257,29 @@ public class MainActivity extends ActionBarActivity { } /** - * Enable / Disable Point annotations. + * Enable / Disable markers. * - * TODO: Implement updating the UI and removing point annotations from the map. + * TODO: Implement updating the UI and removing markers from the map. * - * @param enablePointAnnotations + * @param enableMarkers */ - private void togglePointAnnotations(boolean enablePointAnnotations) { - if (enablePointAnnotations) { - if (!mIsPointAnnotationsOn) { - mIsPointAnnotationsOn = true; - addPointAnnotations(); + private void toggleMarkers(boolean enableMarkers) { + if (enableMarkers) { + if (!mIsMarkersOn) { + mIsMarkersOn = true; + addMarkers(); } } else { - if (mIsPointAnnotationsOn) { - mIsPointAnnotationsOn = false; + if (mIsMarkersOn) { + mIsMarkersOn = false; } } } - private void addPointAnnotations() { + private void addMarkers() { LatLng backLot = new LatLng(38.649441, -121.369064); - mMapFragment.getMap().addAnnotation(backLot); + mMapFragment.getMap().addMarker(backLot); } // This class forwards location updates to updateLocation() diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml index 965f882545..f16522d99c 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml @@ -4,7 +4,7 @@ android:icon="@drawable/ic_action_about" android:title="@string/action_debug" app:showAsAction="ifRoom" /> - <item android:id="@+id/action_point_annotations" + <item android:id="@+id/action_markers" android:icon="@android:drawable/ic_menu_myplaces" android:title="@string/action_point_annotations" app:showAsAction="ifRoom" /> |