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.
MyLocation Accuracy Ring Doesn't Match User Dot #4878
The new MyLocationView API introduced the ability to tint the User Dot and Accuracy Ring. However the current setup in the TestApp is using a blue User Dot and red Accuracy Ring. By default, the Accuracy Ring should share the same Tint (blue in this case) as the User Dot.
I've reset the Accuracy Ring to use the default Mapbox Blue style, however when run in the TestApp it's still being overwritten somewhere as red continues to be the color used. Will continue to investigate.
@bleege this was done for supporting the material theme colors (primary, primaryDark and accent) and automatically tint all the different UI components. I have no problem changing this to blue but please use the ColorUtils.getPrimaryColor(context)) instead. What you are now proposing, defeats the whole automatic tinting and will result in everybody having a blue accuracy circle. While it should be extracted from the users theme.
I'm seeing that the accuracy color method is being called twice for MyLocationToggleActivity with the following values:
V/MapboxMap: ACCURACY #1E8CAB -> blue
V/MapboxMap: ACCURACY #E55E5E -> red
My initial guess is that the default red is coming from MapboxMapOptions and I'm also guessing we can remove the following section in the init method form MyLocationView because defaults will be provided by MapboxMapOptions.
I found another issue where tint wasn't applied in MapboxMapOptions because we aren't providing a drawables in that place. I optimised MyLocationView to store the tint values and apply them everytime a drawable has been set for foreground or background.
Because the getColor method always requires a return value and it seems that -1 equals Color.White. I looked into applying Integer.MAX_VALUE but that seems to be equal to Color.Black. Need to check if getColorStateList provides a workaround because tinting should remain optional and not forced.
@bleege I PR'ed changes to resolve above in #4878 feel free to test and review it.
Also feel free to provide feedback on the tinting we are exposing for end developers.
@cammace because of the new behavior, an the new ways to customize the location view, this looks like a great candidate for a guide and/or a dedicated sample.
I just ran the the code from #4878 / brach 4878-mylocationview-tint and the red accuracy circle still remains (see below). I'm thinking that there's still some trouble in MapboxMapOptions as I also notice that the FAB's background tint is also getting overwritten somewhere along the line too as it's set to use the primary color in the Layout XML.
@cammace because of the new behavior, an the new ways to customize the location view, this looks like a great candidate for a guide and/or a dedicated sample.
Most definitely. For functionality like this we should have this in the TestApp as well. I'm thinking that we'll need a 3 option toggle to show the different options and how they work to developers:
Regular
Blue User Dot and Blue Accuracy Ring
Changed Dot Tint (that also changes Accuracy Ring by default too)
Green User Dot and Green Accuracy Ring
Changed Accuracy Ring Tint (that leaves the User Dot it's current color)
Sure enough. I removed the app from my device, did a full clean build, and deployed again.
Computers. ¯_(ツ)_/¯
That said, we need to fix the mapbox:my_location_background_tint attribute issue. When it's removed the circle is stroked with black when it should be white by default. It's ok to leave this API option in there for app's that want total control, but the SDK shouldn't force users to add it to get the default white stroke.
I found the issue that was forcing the mapbox:my_location_background_tint attribute to have to be set in order to get the white ring around the user dot. It had to do with when MapboxMapOptions was initially setting up it's values by checking the attributes list and if it didn't find this attribute being set (which is likely the be the majority use case) it was defaulting to Color.TRANSPARENT which is why it was showing as dark blue / black. Now that it default loads white so the User Dot will match the iOS SDK.
Activity
[android] #4878 - Setting default accuracy ring to mapbox blue to mat…
bleege commentedon Apr 27, 2016
I've reset the Accuracy Ring to use the default Mapbox Blue style, however when run in the TestApp it's still being overwritten somewhere as red continues to be the color used. Will continue to investigate.
tobrun commentedon Apr 28, 2016
@bleege this was done for supporting the material theme colors (primary, primaryDark and accent) and automatically tint all the different UI components. I have no problem changing this to blue but please use the
ColorUtils.getPrimaryColor(context))instead. What you are now proposing, defeats the whole automatic tinting and will result in everybody having a blue accuracy circle. While it should be extracted from the users theme.tobrun commentedon Apr 28, 2016
@bleege I'm looking into why the changes aren't overwritten
tobrun commentedon Apr 28, 2016
I'm seeing that the accuracy color method is being called twice for
MyLocationToggleActivitywith the following values:My initial guess is that the default red is coming from MapboxMapOptions and I'm also guessing we can remove the following section in the
initmethod formMyLocationViewbecause defaults will be provided byMapboxMapOptions.tobrun commentedon Apr 28, 2016
I found another issue where tint wasn't applied in
MapboxMapOptionsbecause we aren't providing a drawables in that place. I optimisedMyLocationViewto store the tint values and apply them everytime a drawable has been set for foreground or background.tobrun commentedon Apr 28, 2016
I did some fixes to initial state, used resources and clean up the old resources from previous implementation.
tobrun commentedon Apr 28, 2016
@bleege
This is the current default
MyLocationView:Color palette:
Attribution:
cc @zugaldia @cammace
To have the UserLocationView compliant to our old design I added the following in xml:
tobrun commentedon Apr 28, 2016
I'm noticing an issue with:
Because the
getColormethod always requires a return value and it seems that -1 equalsColor.White. I looked into applyingInteger.MAX_VALUEbut that seems to be equal toColor.Black. Need to check ifgetColorStateListprovides a workaround because tinting should remain optional and not forced.tobrun commentedon Apr 28, 2016
Instead of checking against -1, I'm checking against 0 which is equal to
Color.Transparentwhich solves the above.[android] #4878 - fix default color of accuracy circle to match prima…
tobrun commentedon Apr 28, 2016
@bleege I PR'ed changes to resolve above in #4878 feel free to test and review it.
Also feel free to provide feedback on the tinting we are exposing for end developers.
zugaldia commentedon Apr 28, 2016
@tobrun thanks so much for the detailed report.
@cammace because of the new behavior, an the new ways to customize the location view, this looks like a great candidate for a guide and/or a dedicated sample.
bleege commentedon Apr 28, 2016
I just ran the the code from #4878 / brach
4878-mylocationview-tintand the red accuracy circle still remains (see below). I'm thinking that there's still some trouble inMapboxMapOptionsas I also notice that the FAB's background tint is also getting overwritten somewhere along the line too as it's set to use the primary color in the Layout XML.bleege commentedon Apr 28, 2016
Most definitely. For functionality like this we should have this in the TestApp as well. I'm thinking that we'll need a 3 option toggle to show the different options and how they work to developers:
tobrun commentedon Apr 28, 2016
@bleege could you try again?
I'm seeing this without doing any changes on c126994
bleege commentedon Apr 28, 2016
@tobrun Will do.
bleege commentedon Apr 28, 2016
Sure enough. I removed the app from my device, did a full clean build, and deployed again.
Computers. ¯_(ツ)_/¯
That said, we need to fix the
mapbox:my_location_background_tintattribute issue. When it's removed the circle is stroked with black when it should be white by default. It's ok to leave this API option in there for app's that want total control, but the SDK shouldn't force users to add it to get the default white stroke.As Is
Removed Stroke Tint In XML
[android] #4878 - Setting default MyLocationBackgroundTint to be white
bleege commentedon Apr 28, 2016
I found the issue that was forcing the
mapbox:my_location_background_tintattribute to have to be set in order to get the white ring around the user dot. It had to do with when MapboxMapOptions was initially setting up it's values by checking the attributes list and if it didn't find this attribute being set (which is likely the be the majority use case) it was defaulting toColor.TRANSPARENTwhich is why it was showing as dark blue / black. Now that it default loads white so the User Dot will match the iOS SDK.[android] #4878 - fix default color of accuracy circle to match prima…
[android] #4878 - Setting default MyLocationBackgroundTint to be white
bleege commentedon Apr 28, 2016
Rebased and Merged! Thanks everyone!