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

Move Location API From TestApp To SDK #1940

Closed
bleege opened this issue Jul 28, 2015 · 14 comments
Closed

Move Location API From TestApp To SDK #1940

bleege opened this issue Jul 28, 2015 · 14 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@bleege
Copy link
Contributor

bleege commented Jul 28, 2015

The current Location API is custom built and layered on top of the SDK in the TestApp. Let's extract this into the SDK itself so that it can be used universally. Model the API after Google Maps.

Related to #756

@bleege bleege added the Android Mapbox Maps SDK for Android label Jul 28, 2015
@bleege bleege added this to the Android b1 milestone Jul 28, 2015
@ljbade
Copy link
Contributor

ljbade commented Jul 28, 2015

Same as #1719

@bleege bleege self-assigned this Jul 31, 2015
@bleege
Copy link
Contributor Author

bleege commented Jul 31, 2015

The Google Maps API has 2 key access points:

  1. Internal to GoogleMap
  2. User can provide a custom LocationSource

@bleege
Copy link
Contributor Author

bleege commented Jul 31, 2015

Ported Location tech and UserLocation API to GL SDK. Have also refactored the TestApp to run on it. Testing has revealed that the TestApp is using it correctly and that Location is being found. The only issue currently is that the UserLocation marker is not being displayed on the MapView. Next step is to debug that.

@bleege
Copy link
Contributor Author

bleege commented Aug 1, 2015

Turns out the the UserLocation marker is not showing up because the MapView is a View class and can't be added directly. Experimented with having MapView extend ViewGroup and FrameLayout instead while keeping a SurfaceView object in the class. The GL map appears to be running just fine, but still issues remaining while trying to add the UserLocation markr (aka ImageView). Will keep tinkering.

@ljbade
Copy link
Contributor

ljbade commented Aug 2, 2015

@bleege Ah interesting. Hadn't thought of that being an issue but makes sense.

Perhaps we need MapView to be a ViewGroup/FrameLayout with a inner GLSurfaceView constructed at run time we keep as a private member variable.

Then just move some of the calls to set up GL to this variable.

Going to need to something like this to be able to handle things like the Mapbox logo overlay.

bleege added a commit that referenced this issue Aug 4, 2015
…ewGroup and having GL display on map as expected
@bleege
Copy link
Contributor Author

bleege commented Aug 4, 2015

I was able to get MapView to extend ViewGroup instead of SurfaceView so that it'd be possible to layer multiple View objects on top of it. The basic implementation needs to be cleaned up a bit as it's currently struggling with ImageView because ImageView uses a FrameLayout instead of the basic MapView.LayoutParams. I'm not too worried about simplifying the basic implementation this to get it to work though.

For a point of comparison, I looked at the Raster SDK's drawing of UserLocation. It avoids the Android View hierarchy all together and instead relies on direct painting using Canvas. I think it's going to be best to make use of the View hierarchy though as we'll also have the Compass to add too.

@bleege
Copy link
Contributor Author

bleege commented Aug 4, 2015

Refactoring to FrameLayout is showing some promise. Was able to get the UserLocation marker to appear. I'm now working on making sure it updates fast enough and is controllable by the implementing app. A few things still to iron out, but it's looking promising.

bleege added a commit that referenced this issue Aug 4, 2015
bleege added a commit that referenced this issue Aug 5, 2015
bleege added a commit that referenced this issue Aug 5, 2015
@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Just got UserLocation Dot! It just required refactoring the OnMapChangedListener support to be able to handle N listeners instead of just one. Performance seems decent for now in the TestApp.

Next up is to move the Compass to the SDK and then everything should be SDK side, instead of app development side.

device-2015-08-04-190457

@ljbade
Copy link
Contributor

ljbade commented Aug 5, 2015

Awesome work @bleege. What other UI widgets are missing from the map compared to iOS? Logo? Attribution?

@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Initial port of Compass from TestApp to SDK is done. Now adding Google Maps API compatible on/off API.

bleege added a commit that referenced this issue Aug 5, 2015
…ion_marker assets from App as they're now only in the SDK.
@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Added Google Maps API as well as a way to test it in the TestApp. All 👀 good.

Punting on User Dot location accuracy for now, as they're likely be a new image UI / UX for it (ticket coming soon). We also need the Location API in the SDK sooner rather than later for testing.

Merge is up next.

@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Merged in #1999.

@bleege bleege closed this as completed Aug 5, 2015
@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Ugh... found a NullPointerException...

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setVisibility(int)' on a null object reference
            at com.mapbox.mapboxgl.views.MapView.updateMap(MapView.java:1657)
            at com.mapbox.mapboxgl.views.MapView.access$800(MapView.java:65)
            at com.mapbox.mapboxgl.views.MapView$1.onMapChanged(MapView.java:601)
            at com.mapbox.mapboxgl.views.MapView$3.run(MapView.java:1410)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:5835)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

@bleege
Copy link
Contributor Author

bleege commented Aug 5, 2015

Addressed in #2000. Will roll new SNAPSHOT now.

@bleege bleege closed this as completed Aug 5, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
…ing ViewGroup and having GL display on map as expected
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
… location_marker assets from App as they're now only in the SDK.
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
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

No branches or pull requests

3 participants