diff options
author | Brad Leege <bleege@gmail.com> | 2015-08-12 10:33:35 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-08-12 10:33:35 -0500 |
commit | 91cf989d8c989fc09e5a8a948b66d8a4151996dd (patch) | |
tree | 4503346433dcd685c55ec8a7c9c4b81bc1ad9b97 /android/java | |
parent | c1d796bbc173ee64aecd4816a1099fe449ec8ad9 (diff) | |
download | qtlocation-mapboxgl-91cf989d8c989fc09e5a8a948b66d8a4151996dd.tar.gz |
#1856 - Move Map display to user location when location is enabled
Diffstat (limited to 'android/java')
-rw-r--r-- | android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java | 5 |
1 files changed, 5 insertions, 0 deletions
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 79b366d420..5ef019110f 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 @@ -2,6 +2,7 @@ package com.mapbox.mapboxgl.testapp; import android.graphics.Color; import android.graphics.PointF; +import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; @@ -331,6 +332,10 @@ public class MainActivity extends AppCompatActivity { if (enableGps) { if (!mapView.isMyLocationEnabled()) { mapView.setMyLocationEnabled(enableGps); + Location location = mapView.getMyLocation(); + if (location != null) { + mapView.setCenterCoordinate(new LatLng(location), true); + } locationFAB.setColorFilter(getResources().getColor(R.color.primary)); } } else { |