summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java70
1 files changed, 36 insertions, 34 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
index da741d7396..abf0c3ba44 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
@@ -70,12 +70,12 @@ public class MyLocationView extends View {
private ValueAnimator directionAnimator;
private ValueAnimator.AnimatorUpdateListener invalidateSelfOnUpdateListener =
- new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- invalidate();
- }
- };
+ new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ invalidate();
+ }
+ };
private Drawable foregroundDrawable;
private Drawable foregroundBearingDrawable;
@@ -134,8 +134,8 @@ public class MyLocationView extends View {
// setup LayoutParams
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT);
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
setLayoutParams(lp);
matrix = new Matrix();
@@ -165,7 +165,7 @@ public class MyLocationView extends View {
}
if (defaultDrawable.getIntrinsicWidth() != bearingDrawable.getIntrinsicWidth()
- || defaultDrawable.getIntrinsicHeight() != bearingDrawable.getIntrinsicHeight()) {
+ || defaultDrawable.getIntrinsicHeight() != bearingDrawable.getIntrinsicHeight()) {
throw new RuntimeException("The dimensions from location and bearing drawables should be match");
}
@@ -232,8 +232,8 @@ public class MyLocationView extends View {
int horizontalOffset = backgroundOffsetLeft - backgroundOffsetRight;
int verticalOffset = backgroundOffsetTop - backgroundOffsetBottom;
backgroundBounds = new Rect(-backgroundWidth / 2 + horizontalOffset,
- -backgroundHeight / 2 + verticalOffset, backgroundWidth / 2 + horizontalOffset, backgroundHeight / 2
- + verticalOffset);
+ -backgroundHeight / 2 + verticalOffset, backgroundWidth / 2 + horizontalOffset, backgroundHeight / 2
+ + verticalOffset);
backgroundDrawable.setBounds(backgroundBounds);
int foregroundWidth = foregroundDrawable.getIntrinsicWidth();
@@ -251,7 +251,7 @@ public class MyLocationView extends View {
super.onDraw(canvas);
if (location == null || foregroundBounds == null || backgroundBounds == null || accuracyAnimator == null
- || screenLocation == null) {
+ || screenLocation == null) {
// Not ready yet
return;
}
@@ -429,10 +429,11 @@ public class MyLocationView extends View {
private void toggleGps(boolean enableGps, boolean isCustomLocationSource) {
if (enableGps) {
if (locationSource == null) {
- if (!isCustomLocationSource)
+ if (!isCustomLocationSource) {
locationSource = LocationSource.getLocationEngine(this.getContext());
- else
+ } else {
return;
+ }
}
// Set an initial location if one available
Location lastLocation = locationSource.getLastLocation();
@@ -450,8 +451,9 @@ public class MyLocationView extends View {
locationSource.setPriority(LocationEnginePriority.HIGH_ACCURACY);
} else {
- if (locationSource == null)
+ if (locationSource == null) {
return;
+ }
// Disable location and user dot
location = null;
locationSource.removeLocationUpdates();
@@ -499,17 +501,17 @@ public class MyLocationView extends View {
// center map directly
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(false);
mapboxMap.easeCamera(CameraUpdateFactory.newLatLng(new LatLng(location)), 0, false /*linear interpolator*/,
- new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
+ new MapboxMap.CancelableCallback() {
+ @Override
+ public void onCancel() {
- }
+ }
- @Override
- public void onFinish() {
- mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
- }
- });
+ @Override
+ public void onFinish() {
+ mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
+ }
+ });
} else {
// do not use interpolated location from tracking mode
latLng = null;
@@ -687,17 +689,17 @@ public class MyLocationView extends View {
builder.bearing(rotation);
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(false);
mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(builder.build()), COMPASS_UPDATE_RATE_MS,
- false /*linear interpolator*/, new MapboxMap.CancelableCallback() {
- @Override
- public void onCancel() {
+ false /*linear interpolator*/, new MapboxMap.CancelableCallback() {
+ @Override
+ public void onCancel() {
- }
+ }
- @Override
- public void onFinish() {
- mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
- }
- });
+ @Override
+ public void onFinish() {
+ mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
+ }
+ });
}
@Override
@@ -874,7 +876,7 @@ public class MyLocationView extends View {
locationChangeAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
locationChangeAnimator.setDuration(locationUpdateDuration);
locationChangeAnimator.addUpdateListener(new MarkerCoordinateAnimatorListener(this,
- latLng, newLocation
+ latLng, newLocation
));
locationChangeAnimator.start();
latLng = newLocation;