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.

Replace MapChange enum with ints #2586

Closed

Description

@ljbade

Over in #2049 @tobrun noted that Google reccomend int constants instead of enums: https://www.youtube.com/watch?v=Hzs6OBcvNQE

We should at least switch over MapChange.

@tobrun @bleege @zugaldia Are there any other enums we could change?

Activity

  1. added
    Android
    on Oct 9, 2015
  2. added this to the android-v2.2.0 milestone on Oct 9, 2015
  3. tobrun commented on Oct 10, 2015

    @tobrun
    Member

    One thing I need to mention about this is that you can't always provide the type safety the IDE wants.
    Following line will give a lint error because the returned int is not limited to our 'enum'.

    setUserLocationTrackingMode(savedInstanceState.getInt(STATE_USER_LOCATION_TRACKING, TRACKING_NONE));

    You can locally disable this inspection using:

    //noinspection ResourceType       
    setUserLocationTrackingMode(savedInstanceState.getInt(STATE_USER_LOCATION_TRACKING, TRACKING_NONE));
  4. tobrun commented on Oct 10, 2015

    @tobrun
    Member

    I was thinking about StyleUrls, we could replace

    MapView.StyleUrls.MAPBOX_STREETS

    With this:

    MapView.STYLE_MAPBOX_STREETS

    But I'm not sure if this is what we need for long term objectives.

  5. bleege commented on Oct 10, 2015

    @bleege
    Contributor

    TBH, I kind of like the idea of like the idea of separating MapView from Styles altogether. Something like:

    Styles.MAPBOX_STREETS
    
    // Usage
    MapView mv = ...
    mv.setStyle(Styles.MAPBOX_STREETS);
  6. tobrun commented on Oct 10, 2015

    @tobrun
    Member

    @bleege
    something like in b6eb431?

    image

  7. added a commit that references this issue on Oct 11, 2015
  8. tobrun commented on Oct 11, 2015

    @tobrun
    Member

    Refactored MapChange:
    screen shot 2015-10-11 at 10 16 58

    I left MapChange inside of MapView but could be moved to a dedicated class as well (eg. Style)

  9. added a commit that references this issue on Oct 11, 2015
  10. bleege commented on Oct 12, 2015

    @bleege
    Contributor

    @tobrun I ❤️ the Style refactor. 👍 to the MapChange refactor too. This is good to get this into 2.1.0.

  11. added 2 commits that reference this issue on Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidrefactor

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions