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.
Add support for tinting UserLocationView and Attribution icon #3231
iOS currently exposes a feature that allows tinting the UserLocationView and the Attribution Icon.
On Android we can support automatic tinting by using:
<resources>
<!-- inherit from the material theme -->
<stylename="AppTheme"parent="android:Theme.Material">
<!-- Main theme colors --><!-- your app branding color for the app bar -->
<itemname="android:colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<itemname="android:colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<itemname="android:colorAccent">@color/accent</item>
</style>
</resources>
Above tests were done on a Marshmallow device containing the newer attributes, a quick test on a older device shows that this is not working on device prior to Lollipop:
My initial idea that attributes are not available is incorrect, these will probably be added by the support-v7 dependency. The code mentioned here is returning the correct value after I debugged it with Integer.toHexString(typedValue.data) -> #fff44336.
The blocking part for this issue was not being able to tint UserLocationView.
I'm picking that up as part of #4396 and I will merge in this functionality as part of that PR.
Current tinting result can be seen in the third row:
Automatic tinting worked great when I was using mapbox version 4.2.2. I just made a big version jump to 6.6.0 and the attribution icon as well as the dialog window ignore the app's primary color. @tobrun Is automatic tinting in primary color still supposed to work?
we removed that at a point to not include certain support libraries, nowadays we are including them anyways and we could bring this feature back. For now you can set these colors yourself with using MapboxMap#getUiSettings()
Activity
tobrun commentedon Jan 13, 2016
I have seen requests for this feature, going to add it now
tobrun commentedon Jan 13, 2016
I'm able to reference the client app from the library using
colorPrimary,colorPrimaryDarkandcolorAccentas attributes:tobrun commentedon Jan 13, 2016
Tinting the attribution icon will require creating a state selector programatically with tinted drawables.
Tinting the UserLocationView will require some refactoring, it is using an image with multiple colors.
tobrun commentedon Jan 13, 2016
Here is an example where I changed the colors of the testapp:
As you can see, we need to refactor
UserLocationViewto draw the outer white circle programatically.tobrun commentedon Jan 13, 2016
I forgot to mention the update to attribution dialog:
tobrun commentedon Jan 13, 2016
Above tests were done on a Marshmallow device containing the newer attributes, a quick test on a older device shows that this is not working on device prior to Lollipop:
tobrun commentedon Jan 13, 2016
My initial idea that attributes are not available is incorrect, these will probably be added by the
support-v7dependency. The code mentioned here is returning the correct value after I debugged it withInteger.toHexString(typedValue.data)-> #fff44336.The actual problem is related to wrapping drawables.
Result after fix on pre-lollipop device:
tobrun commentedon Jan 13, 2016
Items required to close this issue:
support-v7dependencyUserLocationViewto draw a white circle pragmatically[android] #3231 - tinting colors
17 remaining items
tobrun commentedon Apr 8, 2016
The blocking part for this issue was not being able to tint UserLocationView.
I'm picking that up as part of #4396 and I will merge in this functionality as part of that PR.
Current tinting result can be seen in the third row:
tobrun commentedon Apr 25, 2016
User Location View tinting has landed in #4695.
We can now start with integration of this feature.
tobrun commentedon Apr 26, 2016
I resurrected the code form the related PR and cherrypicked in onto current master:
Our testapp styles are now automatically applied using the
primary,primaryDarkandprimaryAccent:Changing our theme colors to red, darkRed and yellow:
bleege commentedon Apr 26, 2016
🚀 🚀 🚀 🚀
p-fischer commentedon Oct 17, 2018
Automatic tinting worked great when I was using mapbox version 4.2.2. I just made a big version jump to 6.6.0 and the attribution icon as well as the dialog window ignore the app's primary color.
@tobrun Is automatic tinting in primary color still supposed to work?
tobrun commentedon Oct 17, 2018
we removed that at a point to not include certain support libraries, nowadays we are including them anyways and we could bring this feature back. For now you can set these colors yourself with using
MapboxMap#getUiSettings()