-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expose a generic Android View Marker API #3276
Comments
Related: #3116 |
Related: #1125 |
To make this a bit more concrete:
The syncing is performed in these following lines of code: @Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
mCompassView.update(getDirection());
mUserLocationView.update();
for (InfoWindow infoWindow : mInfoWindows) {
infoWindow.update();
}
} Instead of updating these Views one by one, |
While working on a related Marker issue I noticed that |
The |
@1ec5 Thanks for clarifying! I re-ran the test and that's what it does. |
As it happens, that transformation is incorrect: see #5218. |
Hi @tobrun @bleege ! |
@p-fischer Thanks for considering Mapbox! Markers are have undergone a big change in the 4.1.0 code base so confusion isn't surprising. 😄 We won't have official documentation / examples of this ready on mapbox.com until we ship 4.1.0 Final (likely in the next week or so). In the meantime though I'd recommend exploring the code in the TestApp as it's the Android app that we use internally to build these API into the SDK. As such it's always the most up to date reference materials that we have. We're currently working on the TestApp Home Page Annotation (which Markers are part of) Examples Marker InfoWindow Examples As always, we produce nightly builds (called SNAPSHOTS) that anyone can use to get the latest updated code from the day! Instructions on how to install them can be found on the Mapbox Android SDK Web site. |
Thanks @bleege , I finally could get a marker view to be displayed :) The issues I'm now having are:
[...] |
@p-fischer Glad that you're up and running! If you can share some of the code that's causing these problems for you we'd be happy to help you figure them out. |
Hi @bleege , I basically copied the classes CountryAdapter, CountryMarker, CountryMarkerOptions, CountryMarkerView, and CountryMarkerViewOptions from the TestApp, you pointed me to, and put a map view in a fragment in my app. |
Hi, depending on what you are trying to achieve it is meanwhile also possible to use some default image adapter and all you have to do is
so you could also set up a more complex Drawable that you can use as Icon then. |
@p-fischer Looking at the log I think the first place to start is to make sure that you're building the proper ABI of Core GL that your device is expecting. This is the Setup Project Locally Instructions Running The TestApp Instructions |
@bleege I got the TestApp running, thanks. However, I copied the TestApp Module and referenced the SDK the SNAPSHOT as a dependency. For lazy people like me, it might be handy to have the Test App in a separate repository referencing the SDK only through a dependency ;) I did observe that issue that the map can not be panned starting touch on a marker view on the Test App as well. I think that should be possible because you want the marker view behavior to be consistent with the behavior of the ordinary markers. |
@p-fischer Glad that you were able to get things running. I agree it'd be helpful to have the TestApp in a separate repository but it'd also have to continue living in it's current spot as it's how day to day development has to be done because the SDK is an Android Library. FWIW, we're starting to add more examples to the Demo App if you're interested in these types of things. https://github.com/mapbox/mapbox-android-demo
Yep, I was able to recreate this too in the TestApp. As the gif shows below I tried panning underneath the Mapbox logo and it worked and then I tried panning by touching the Mapbox logo and it didn't. Meanwhile this same process worked when I tried panning on the red GL based marker. At first glance it sounds like the gestures are being consumed at the View Annotation level and not being forwarded on to the MapView. We'll keep looking into this as you're correct that the behavior should be consistent with the GL markers. |
Current Marker API on android is fairly limited because Markers are Gl-drawn components. I'm hearing about requests for animating markers or having the ability to do more typical Android SDK visual things with it (animations, selectors etc.).
Concurrent InfoWindows
from #3127 andUserLocationView
showcased that we are able to sync Android Views with the underlying MapView. The logic is their but we do not expose a generic system.API proposal:
For native annotations views in the Android Mapbox SDK. I don't see any reason to stray far from the adapter concept what an Android developer uses on daily basis. Combining this with the existing Mapbox API for adding annotations will look like:
Example API
Integration of the API will follow the same path as the current Marker API.
On top of that it will expose some new APIs to make ViewMarkers possible:
An example of the
MarkerViewAdapter
shown above:Next steps:
selectMarker(Marker m)
API - @tobrunremoveMarker(Marker m)
API - @tobrun@incanus @bleege @zugaldia @cammace @danswick
The text was updated successfully, but these errors were encountered: