Skip to content

Commit

Permalink
mapbox#1856 - Move Map display to user location when location is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Aug 12, 2015
1 parent d6c6fc1 commit dc14328
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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;
Expand Down Expand Up @@ -331,6 +332,10 @@ private void toggleGps(boolean enableGps) {
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 {
Expand Down

0 comments on commit dc14328

Please sign in to comment.