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

[android] #4326 - using the camera API vs getCameraPosition #4405

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Mar 21, 2016

closes #4326

cc @bleege @zugaldia

@tobrun tobrun added Android Mapbox Maps SDK for Android ✓ ready for review labels Mar 21, 2016
@tobrun tobrun added this to the android-v4.0.0 milestone Mar 21, 2016
@tobrun
Copy link
Member Author

tobrun commented Mar 21, 2016

Unit tests don't approve my changes, I now remember why I initially saved the CameraPosition, this was for being able to unit test the Camera API. Going to revisit this before this is able to be reviewed.

@tobrun
Copy link
Member Author

tobrun commented Mar 21, 2016

All right success, got both logic and unit tests aligned correctly:

03-21 19:57:33.429 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.9320668330013, latitude=20.114912700070548, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.429 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.9320668330013, latitude=20.114912700070548, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.432 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.9320668330013, latitude=20.114912700070548, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.432 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.9320668330013, latitude=20.114912700070548, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.710 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.891000463401042, latitude=20.205262308280385, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.710 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.891000463401042, latitude=20.205262308280385, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.734 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.880894384375665, latitude=20.225012231557038, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.734 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.880894384375665, latitude=20.225012231557038, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.737 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.880894384375665, latitude=20.225012231557038, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:33.737 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.880894384375665, latitude=20.225012231557038, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.072 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.790998149366374, latitude=20.376255914907386, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.072 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.790998149366374, latitude=20.376255914907386, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.075 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.790998149366374, latitude=20.376255914907386, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.075 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.790998149366374, latitude=20.376255914907386, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.116 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.787638240666126, latitude=20.384724312215813, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.116 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.787638240666126, latitude=20.384724312215813, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.436 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.709293933607825, latitude=20.52882995031878, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.436 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.709293933607825, latitude=20.52882995031878, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.440 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.709293933607825, latitude=20.52882995031878, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.440 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.709293933607825, latitude=20.52882995031878, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.522 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.704257805200257, latitude=20.54460684149224, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.522 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.704257805200257, latitude=20.54460684149224, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.928 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.691795204013573, latitude=20.58364195499003, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:34.928 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.691795204013573, latitude=20.58364195499003, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:35.334 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687696918031946, latitude=20.5964763445874, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:35.334 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687696918031946, latitude=20.5964763445874, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:36.739 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687457819771595, latitude=20.597225082858536, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:36.739 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687457819771595, latitude=20.597225082858536, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:36.739 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687457819771595, latitude=20.597225082858536, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:36.739 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687457819771595, latitude=20.597225082858536, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=9.687457819771595, latitude=20.597225082858536, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=10.000200000000007, latitude=19.99999999999999, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=10.000200000000007, latitude=19.99999999999999, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=10.000200000000007, latitude=19.99999999999999, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=10.000200000000007, latitude=19.99999999999999, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0
03-21 19:57:37.041 13992-13992/com.mapbox.mapboxsdk.testapp V/MainActivity: OnCameraChange : Target: LatLng [longitude=10.000200000000007, latitude=19.99999999999999, altitude=0.0], Zoom:10.0, Bearing:63.7888069152832, Tilt:0.0

Above you can see one line the update to onCameraChangeListener.
Second line is the one from getCameraPosition.

@bleege
Copy link
Contributor

bleege commented Mar 21, 2016

Looking at this now. Build fails on device due to #4175 being fixed after this branch. Will rebase and try again.

@bleege
Copy link
Contributor

bleege commented Mar 21, 2016

I tested it out by adding an extra Log statement to the MainActivity.java locally that prints out the MapboxMap.getCameraPosition() below the CameraPostition object that comes via onCameraChange() (see screenshot below). I then double tapped on the map (specifically around Germany) and the logs below show that things are working as expected.

screen shot 2016-03-21 at 4 47 07 pm
Double Logs

03-21 16:50:07.156 5875-5875/com.mapbox.mapboxsdk.testapp I/ScaleGestureDetector: TwScaleGestureDetector
03-21 16:50:07.206 5875-5875/com.mapbox.mapboxsdk.testapp I/MainActivity: OnCameraChange : Target: LatLng [longitude=8.58682048174606, latitude=6.799765818497882, altitude=0.0], Zoom:1.126704454421997, Bearing:-0.0, Tilt:0.0
03-21 16:50:07.206 5875-5875/com.mapbox.mapboxsdk.testapp I/MainActivity: OnCameraChange (Map) : Target: LatLng [longitude=8.58682048174606, latitude=6.799765818497882, altitude=0.0], Zoom:1.126704454421997, Bearing:-0.0, Tilt:0.0
03-21 16:50:07.516 5875-5875/com.mapbox.mapboxsdk.testapp I/MainActivity: OnCameraChange : Target: LatLng [longitude=11.747702808721641, latitude=30.420113153936104, altitude=0.0], Zoom:2.126704454421997, Bearing:-0.0, Tilt:0.0
03-21 16:50:07.516 5875-5875/com.mapbox.mapboxsdk.testapp I/MainActivity: OnCameraChange (Map) : Target: LatLng [longitude=11.747702808721641, latitude=30.420113153936104, altitude=0.0], Zoom:2.126704454421997, Bearing:-0.0, Tilt:0.0

Next step is to merge into release-ios-3.2.0-android-4.0.0.

@bleege
Copy link
Contributor

bleege commented Mar 21, 2016

Rebased and merged on to release-ios-3.2.0-android-4.0.0. Since this PR was against the release branch will rely on the post release merge back into master to bring this functionality back inline.

screen shot 2016-03-21 at 4 59 52 pm

/cc @jfirebaugh

@bleege bleege closed this Mar 21, 2016
@bleege bleege deleted the 4326-OnCameraChangeListenerVsGetCameraPosition branch March 21, 2016 22:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants