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

Remove requirement for an Adapter on MarkerView #5214

Closed
tobrun opened this issue Jun 2, 2016 · 6 comments
Closed

Remove requirement for an Adapter on MarkerView #5214

tobrun opened this issue Jun 2, 2016 · 6 comments
Labels
Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android

Comments

@tobrun
Copy link
Member

tobrun commented Jun 2, 2016

Currently we require a developer to provide an MarkerViewAdapter to be able show a MarkerView.
Current game plan is to remove this requirement and handle the logic for them. Internally the base MarkerView will be backed up by ImageMarkerViewAdapter and will leverage the Icon attribute in Marker.

@tobrun tobrun added Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android labels Jun 2, 2016
@tobrun tobrun added this to the android-v4.1.0 milestone Jun 2, 2016
@Schumi09
Copy link

Schumi09 commented Jun 2, 2016

Sounds amazing, this will make it much more handy! I couldn't even convert the icon's bitmap of the passed marker back to a drawable and use it for viewHolder.icon.setImageDrawable()
Guess I don't have to write my own View classes anymore just to pass a drawable directly.

@tobrun
Copy link
Member Author

tobrun commented Jun 2, 2016

@Schumi09

I couldn't even convert the icon's bitmap of the passed marker back to a drawable and use it for viewHolder.icon.setImageDrawable())

With the changes made you can achieve that as well ;)

@tobrun
Copy link
Member Author

tobrun commented Jun 2, 2016

This is the code a developer needs to write to show a normal MarkerView:

   MarkerViewOptions options = new MarkerViewOptions();
                options.title("United States");
                options.icon(IconFactory.getInstance(mMapView.getContext())
                        .fromResource(R.drawable.ic_us));
                options.position(new LatLng(38.899774, -77.023237));
                options.flat(true);
    markerView = mapboxMap.addMarker(options);

Below you can see where I'm updating the Icon every 3 seconds through markerView.setIcon():

ezgif com-video-to-gif

@Schumi09
Copy link

Schumi09 commented Jun 2, 2016

Good job 👍

Will it make it into the tomorrow's snapshot?

Maybe you could also test the behaviour of the issues I have experienced concerning the removing and adding new markerviews (#5161). Moreover, you said that the View things will provide a fix to disappearing Icons/Markers during runtime. Did it fix it?

@tobrun
Copy link
Member Author

tobrun commented Jun 2, 2016

Maybe you could also test the behaviour of the issues I have experienced concerning the removing and adding new markerviews (#5161).

I'm planning to do some general improvement to this system in #5076, this includes looking into above.

you said that the View things will provide a fix to disappearing Icons/Markers during runtime. Did it fix it?

Yes this issue should be resolved by using this API.

@tobrun
Copy link
Member Author

tobrun commented Jun 3, 2016

merged with 087cad0, closing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android
Projects
None yet
Development

No branches or pull requests

2 participants