You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
AnnotationOptions.alpha Needs To Return SuperType #2631
Currently AnnotationOptions.alpha()returns an AnnotationsOptions object. While this is functional, it requires casting to be applied in common Builder patterns which isn't good. For example:
MapViewmap = ...;
// worksmap.addPolygon(newPolygonOptions().add(latLngs));
// currently doesn't work due to typing, but is idealmap.addPolygon(newPolygonOptions().add(latLngs).alpha(0.5f));
// casting needed to make work, but not something that should be used map.addPolygon((PolygonOptions) newPolygonOptions().add(latLngs).alpha(0.5f));
Looking at Google's implementation they avoided this problem all together by keeping PolygonOptions, PolyLineOptions, and MarkerOptions all independent. In other words, they don't use DRY and each one of these Option classes extends from java.lang.Object and implements android.os.Parcelable.
Doing some R&D on this shows that the AnnotationsOptions abstract class came as part of clean up / refactoring in #1716. In other words this was introduced in Mapbox and not needed as part of the Google API (confirms previous statement on API).
Activity
ljbade commentedon Oct 15, 2015
Interesting, the other options support this. Also core GL marker don't support alpha, so only needed for lines and polygons.
[android] Refactor annotations API
tobrun commentedon Oct 16, 2015
@bleege didn't the generic builder pattern solve this?
bleege commentedon Oct 16, 2015
@tobrun I didn't have time to finish yesterday afternoon so I just created this issue to make sure this was known. Hoping to get it to today.
bleege commentedon Oct 16, 2015
Looking at Google's implementation they avoided this problem all together by keeping PolygonOptions, PolyLineOptions, and MarkerOptions all independent. In other words, they don't use DRY and each one of these Option classes extends from
java.lang.Objectand implementsandroid.os.Parcelable.bleege commentedon Oct 16, 2015
Doing some R&D on this shows that the
AnnotationsOptionsabstract class came as part of clean up / refactoring in #1716. In other words this was introduced in Mapbox and not needed as part of the Google API (confirms previous statement on API).ljbade commentedon Oct 16, 2015
@bleege Does the same apply to the
Marker,Polyline,Polygonclasses? If we split these up we will need to do a bit of re-factoring inMapView.Also should point out this was an easy fix in my large PR, I just pushed
.alphato the concrete classes.[android] #2631 - Removing AnnotationsOptions and MultiPointOptions i…
[android] #2631 - Adding alpha() test for PolygonOptions
1 remaining item
[android] #2631 - Removing AnnotationsOptions and MultiPointOptions i…
[android] #2631 - Adding alpha() test for PolygonOptions
bleege commentedon Oct 16, 2015
Rebased and merged.
[android] #2631 - Removing AnnotationsOptions and MultiPointOptions i…
[android] #2631 - Adding alpha() test for PolygonOptions
[android] #2631 - Removing AnnotationsOptions and MultiPointOptions i…
[android] #2631 - Adding alpha() test for PolygonOptions
[android] mapbox#2631 - Removing AnnotationsOptions and MultiPointOpt…
[android] mapbox#2631 - Adding alpha() test for PolygonOptions
[android] Refactor annotations API