Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

setCenterCoordinate doesn't animate #3283

Closed

Description

@tobrun

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.

Activity

  1. added
    Android
    on Dec 14, 2015
  2. added this to the milestone on Dec 14, 2015
  3. tobrun commented on Dec 14, 2015

    @tobrun
    MemberAuthor
  4. tobrun commented on Dec 17, 2015

    @tobrun
    MemberAuthor

    Linking #2049

  5. bleege commented on Dec 17, 2015

    @bleege
    Contributor
  6. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    I'm taking a look a this, will try out the new camera api from #3244

  7. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    Using following methods did not give the expected results:

    • flyTo()
    • jumpTo()
    • easeTo()

    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

  8. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    Next things to do are optimising, backporting and deprecating the setCenterCoordinate method and see how this implementation stacks up in the UserLocationTracking issue

  9. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    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.

  10. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    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 setCenterCoordinate so this issue van be closed down,
    will test out user location tracking in its own issue #2791

  11. bleege commented on Dec 23, 2015

    @bleege
    Contributor

    This looks like it's coming along nicely @tobrun. 👍

    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.).

    Feel free to roll the replacement of setCenterCoordinate() with moveCamera() from #3309 in with this fix. No need to solve the animation issue for the setCenterCoordinate() methods if those methods are going away.

  12. added a commit that references this issue on Dec 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions