Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Closed

Description

@bleege

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.

Activity

  1. added
    Android
    on Apr 27, 2016
  2. added this to the android-v4.1.0 milestone on Apr 27, 2016
  3. added a commit that references this issue on Apr 27, 2016
  4. bleege commented on Apr 27, 2016

    @bleege
    ContributorAuthor

    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.

  5. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    @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.

  6. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    @bleege I'm looking into why the changes aren't overwritten

  7. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    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.

            // default implementation
            setShadowDrawable(ContextCompat.getDrawable(context, R.drawable.ic_userlocationview_shadow));
            setForegroundDrawables(ContextCompat.getDrawable(context, R.drawable.ic_userlocationview_normal), ContextCompat.getDrawable(context, R.drawable.ic_userlocationview_bearing));
            setAccuracyTint(ColorUtils.getPrimaryColor(context));
            setAccuracyAlpha(100);
    
  8. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    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.

  9. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    I did some fixes to initial state, used resources and clean up the old resources from previous implementation.

  10. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    @bleege
    This is the current default MyLocationView:

    screen shot 2016-04-28 at 09 04 30

    Color palette:

    • Center is colorPrimary
    • Edge is colorPrimaryDark
    • Accuracy is colorPrimary with alpha 100/255

    Attribution:

    • Dialog bg is colorPrimary
    • Icon is a selector using colorPrimary

    cc @zugaldia @cammace

    To have the UserLocationView compliant to our old design I added the following in xml:

    mapbox:my_location_background_tint="@android:color/white"

    screen shot 2016-04-28 at 09 56 29

  11. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    I'm noticing an issue with:

      mapboxMapOptions.myLocationForegroundTintColor(typedArray.getColor(R.styleable.MapView_my_location_foreground_tint, -1));

    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.

  12. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    Instead of checking against -1, I'm checking against 0 which is equal to Color.Transparent which solves the above.

  13. added a commit that references this issue on Apr 28, 2016
  14. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    @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.

  15. zugaldia commented on Apr 28, 2016

    @zugaldia
    Member

    @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.

  16. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    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.

    device-2016-04-28-103543

  17. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    @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:

    1. Regular
      • Blue User Dot and Blue Accuracy Ring
    2. Changed Dot Tint (that also changes Accuracy Ring by default too)
      • Green User Dot and Green Accuracy Ring
    3. Changed Accuracy Ring Tint (that leaves the User Dot it's current color)
      • Blue User Dot and Red Accuracy Ring
  18. tobrun commented on Apr 28, 2016

    @tobrun
    Member

    @bleege could you try again?

    I'm seeing this without doing any changes on c126994

    device-2016-04-28-175843

  19. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    @tobrun Will do.

  20. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    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.

    device-2016-04-28-110432
    As Is

    device-2016-04-28-111015
    Removed Stroke Tint In XML

  21. added a commit that references this issue on Apr 28, 2016
  22. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    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.

    // Original
    mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.MapView_my_location_background_tint, Color.TRANSPARENT));
    
    // White
    mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.MapView_my_location_background_tint, Color.WHITE));
  23. added 2 commits that reference this issue on Apr 28, 2016
  24. bleege commented on Apr 28, 2016

    @bleege
    ContributorAuthor

    Rebased and Merged! Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions