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.

Prefix attributes with mapbox #6593

Closed

Description

@tobrun

We expose a fair amount of attributes that developers use to customise a Map in xml.
It's a common best practice to prefix resources with a company name. This is needed to avoid xml naming conflicts. For example I have seen that our zoom attribute was conflicting with another 3th party library attribute.

One way of achieving this is using the [resource prefix configuration in gradle}(http://tools.android.com/recent/androidstudio058released). This results in showing the following picture if resources do not match:
image

We have applied this approach in the past but ended up removing it. I think we should possibly add prefix support for attributes but maybe not enforce the gradle configuration.

Sidenote: to make it easier for users to migrate we can allow using both non and with prefix for a couple of releases.

cc @mapbox/android

Activity

  1. added
    Android
    on Oct 5, 2016
  2. tobrun commented on Oct 5, 2016

    @tobrun
    MemberAuthor

    This is the current list of public resources in the library:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!--Add references to exposed resources-->
        <public name="AttributionAlertDialogStyle" type="style" />
    
        <public name="style_mapbox_streets" type="string" />
        <public name="style_emerald" type="string" />
        <public name="style_light" type="string" />
        <public name="style_dark" type="string" />
        <public name="style_satellite" type="string" />
        <public name="style_satellite_streets" type="string" />
    
        <public name="center_longitude" type="attr" />
        <public name="center_latitude" type="attr" />
        <public name="zoom_level" type="attr" />
        <public name="direction" type="attr" />
        <public name="zoom_enabled" type="attr" />
        <public name="scroll_enabled" type="attr" />
        <public name="rotate_enabled" type="attr" />
        <public name="zoom_controls_enabled" type="attr" />
        <public name="debug_active" type="attr" />
        <public name="style_url" type="attr" />
        <public name="access_token" type="attr" />
        <public name="style_classes" type="attr" />
        <public name="my_location_enabled" type="attr" />
        <public name="compass_enabled" type="attr" />
        <public name="compass_gravity" type="attr" />
        <public name="compass_margin_left" type="attr" />
        <public name="compass_margin_top" type="attr" />
        <public name="compass_margin_right" type="attr" />
        <public name="compass_margin_bottom" type="attr" />
        <public name="logo_gravity" type="attr" />
        <public name="logo_margin_left" type="attr" />
        <public name="logo_margin_top" type="attr" />
        <public name="logo_margin_right" type="attr" />
        <public name="logo_margin_bottom" type="attr" />
        <public name="logo_visibility" type="attr" />
        <public name="attribution_gravity" type="attr" />
        <public name="attribution_margin_left" type="attr" />
        <public name="attribution_margin_top" type="attr" />
        <public name="attribution_margin_right" type="attr" />
        <public name="attribution_margin_bottom" type="attr" />
        <public name="attribution_visibility" type="attr" />
    
        <public name="attribution_logo" type="drawable" />
        <public name="compass" type="drawable" />
        <public name="default_marker" type="drawable" />
        <public name="attribution_button_pressed_selector" type="drawable" />
        <public name="attribution_button_pressed_normal" type="drawable" />
        <public name="attribution_button_pressed_pressed" type="drawable" />
        <public name="my_location" type="drawable" />
        <public name="my_location_bearing" type="drawable" />
        <public name="my_location_stale" type="drawable" />
        <public name="my_location_ring" type="color" />
        <public name="mapbox_blue" type="color" />
    </resources>
  3. zugaldia commented on Oct 5, 2016

    @zugaldia
    Member

    Great catch, something we should definitely fix.

    We have applied this approach in the past but ended up removing it. I think we should possibly add prefix support for attributes but maybe not enforce the gradle configuration.

    Any drawbacks enforcing the gradle setting? It sounds like a good approach a priori to ensure prefixes consistency.

    Sidenote: to make it easier for users to migrate we can allow using both non and with prefix for a couple of releases.

    We can also tag this SEMVER and add it to the list for 5.0.

  4. added
    SEMVER-MAJOR
    on Oct 5, 2016
  5. added this to the milestone on Oct 5, 2016
  6. self-assigned this
    on Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AndroidSEMVER-MAJOR

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions