MyLocationView activate/deactivate LocationSource (#8255)
* [android] - activate/deactivate the locationSource when toggling the MyLocationView state. * correct accuracy width
This commit is contained in:
@@ -257,9 +257,7 @@ public class MyLocationView extends View {
|
||||
|
||||
final PointF pointF = screenLocation;
|
||||
float metersPerPixel = (float) projection.getMetersPerPixelAtLatitude(location.getLatitude());
|
||||
float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel / 2;
|
||||
float maxRadius = getWidth() / 2;
|
||||
accuracyPixels = accuracyPixels <= maxRadius ? accuracyPixels : maxRadius;
|
||||
float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel;
|
||||
|
||||
// reset
|
||||
matrix.reset();
|
||||
@@ -435,10 +433,12 @@ public class MyLocationView extends View {
|
||||
}
|
||||
|
||||
locationEngine.addLocationEngineListener(userLocationListener);
|
||||
locationEngine.activate();
|
||||
} else {
|
||||
// Disable location and user dot
|
||||
location = null;
|
||||
locationEngine.removeLocationEngineListener(userLocationListener);
|
||||
locationEngine.deactivate();
|
||||
}
|
||||
|
||||
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
|
||||
@@ -730,7 +730,7 @@ public class MyLocationView extends View {
|
||||
accuracyAnimator.end();
|
||||
}
|
||||
|
||||
accuracyAnimator = ValueAnimator.ofFloat(accuracy * 10, location.getAccuracy() * 10);
|
||||
accuracyAnimator = ValueAnimator.ofFloat(accuracy, location.getAccuracy());
|
||||
accuracyAnimator.setDuration(750);
|
||||
accuracyAnimator.start();
|
||||
accuracy = location.getAccuracy();
|
||||
|
||||
Reference in New Issue
Block a user