diff options
author | Brad Leege <bleege@gmail.com> | 2015-12-03 13:27:04 -0600 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-12-03 16:57:43 -0600 |
commit | 4dd84b3d92f4ff9e7f06b77c20ca83e2a681212e (patch) | |
tree | ce80820f24c98e4c63dd3d6a9996e966b5f1b19f /android | |
parent | 5024d45c631cd5629a028447a6faf394b1aa20f4 (diff) | |
download | qtlocation-mapboxgl-4dd84b3d92f4ff9e7f06b77c20ca83e2a681212e.tar.gz |
[android] #2805 - Setting TiltActivity to test setPitch() directly. Adding FloatRange annotations to setTilt() and tilt() methods.
Diffstat (limited to 'android')
3 files changed, 13 insertions, 3 deletions
diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index 51c94d9d98..adaf1afa50 100644 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.camera; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.FloatRange; import com.mapbox.mapboxsdk.geometry.LatLng; public final class CameraPosition implements Parcelable { @@ -146,6 +147,7 @@ public final class CameraPosition implements Parcelable { * @param tilt Tilt value * @return Builder */ + @FloatRange(from = 0.0, to = 60.0) public Builder tilt(float tilt) { this.tilt = tilt; return this; diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java index 5db4df4f5d..9b09d999df 100644 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java +++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java @@ -1118,6 +1118,7 @@ public final class MapView extends FrameLayout { * Sets the Tilt in degrees of the MapView * @param pitch New tilt in degrees */ + @FloatRange(from = 0.0, to = 60.0) public void setTilt(double pitch) { mNativeMapView.setPitch(pitch); } diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java index 3d889e8457..7823836bb9 100644 --- a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java +++ b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.util.Log; import android.view.MenuItem; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -33,24 +34,29 @@ public class TiltActivity extends AppCompatActivity { // Target LatLng dc = new LatLng(38.90252, -77.02291); LatLng nyc = new LatLng(40.73581, -73.99155); - LatLng target = nyc; // Set up the map mMapView = (MapView) findViewById(R.id.tiltMapView); mMapView.setAccessToken(ApiAccess.getToken(this)); mMapView.setStyleUrl(Style.MAPBOX_STREETS); - mMapView.setCenterCoordinate(target); + // Initialize map to Washington, DC and different zoom level so that it's obvious that animateCamera works + mMapView.setCenterCoordinate(dc); mMapView.setZoomLevel(11); mMapView.onCreate(savedInstanceState); + Log.i(TiltActivity.class.getCanonicalName(), "Original Tilt = " + mMapView.getTilt()); + mMapView.setTilt(45); + Log.i(TiltActivity.class.getCanonicalName(), "Changed Tilt = " + mMapView.getTilt()); + /* * Our tilt API follows Google's Android API: * https://developers.google.com/maps/documentation/android-api/views#updating_the_camera_view */ +/* // Construct a CameraPosition focusing on target and animate the camera to that position. CameraPosition cameraPosition = new CameraPosition.Builder() - .target(target) // Sets the center of the map to target + .target(nyc) // Sets the center of the map to target .zoom(17) // Sets the zoom .bearing(90) // Sets the orientation of the camera to east .tilt(30) // Sets the tilt of the camera to 30 degrees @@ -58,6 +64,7 @@ public class TiltActivity extends AppCompatActivity { // Triggers tilt mMapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); +*/ } @Override |