-
Notifications
You must be signed in to change notification settings - Fork 1.3k
setCenterCoordinate doesn't animate #3283
Comments
Linking #2049 |
/cc @bsudekum |
I'm taking a look a this, will try out the new camera api from #3244 |
Using following methods did not give the expected results:
I was able to animate it correctly using higher level api: @UiThread
public void setCenterCoordinate(@NonNull LatLng centerCoordinate, boolean animated) {
if (centerCoordinate == null) {
Log.w(TAG, "centerCoordinate was null, so just returning");
return;
}
CameraPosition cameraPosition = new CameraPosition.Builder(getCameraPosition())
.target(centerCoordinate)
.build();
animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition),
(int) ANIMATION_DURATION, null);
} You can see above result here |
Next things to do are optimising, backporting and deprecating the |
Backporting will look like this: public void setCenterCoordinate(@NonNull LatLng centerCoordinate, boolean animated) {
if (centerCoordinate == null) {
Log.w(TAG, "centerCoordinate was null, so just returning");
return;
}
if (animated) {
CameraPosition cameraPosition = new CameraPosition.Builder(getCameraPosition())
.target(centerCoordinate)
.build();
animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition),
(int) ANIMATION_DURATION, null);
} else {
jumpTo(mNativeMapView.getBearing(), centerCoordinate, mNativeMapView.getPitch(), mNativeMapView.getZoom());
}
} For and end-developer the API is unchanged but underneath we are using the newer Camera API. |
Will not add deprecation notice until validated by co-workers and other methods to be deprecated with replaced implementations are in place (eg. bearing, tilt, etc.). Will PR current |
This looks like it's coming along nicely @tobrun. 👍
Feel free to roll the replacement of |
While investigating #2791 I noticed that
setCenterCoordinate(latLng, true /*animated*/)
doesn't work. I have added an example feature activity to help out debug this in #3270. I created this separate feature activity because their are too many moving parts in user location tracking to debug this efficiently.The text was updated successfully, but these errors were encountered: