Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Added dynamic scale widget to map view. #6555

Closed
wants to merge 4 commits into from
Closed

[android] Added dynamic scale widget to map view. #6555

wants to merge 4 commits into from

Conversation

clydebarrow
Copy link
Contributor

Scale is enabled by default, can be disabled in xml or programmatically.
Scale is styleable via xml or programmatically for position, color and distance unit.
Test activity added to TestApp in map layout category.
Sundry refactoring and minor bug fixes found while working in MapView.java.

    Scale is styleable via xml or programmatically
    for position, color and distance unit.
    Test activity added to TestApp in map layout category.
    Some minor refactoring.
Fix state not being saved in a couple of test activities
Fix potential leak of LocationListener in mapview.
@mention-bot
Copy link

@clydebarrow, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tobrun, @cammace and @bleege to be potential reviewers.

@clydebarrow
Copy link
Contributor Author

screenshot 2016-10-03 09 29 16

![scale1](https://cloud.githubusercontent.com/assets/2366188/19028208/4448d434-8985-11e6-83de-c7909a86cbc0.png)

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Oct 3, 2016
@tobrun tobrun self-assigned this Oct 3, 2016
@tobrun
Copy link
Member

tobrun commented Oct 3, 2016

Thank you for contributing, this seems great!
Putting on my radar to review.

@snodnipper
Copy link

As an outsider, my initial thought on this PR was whether a standalone widget may keep the SDK code tighter, similar to MAS. AFAIK, Google Maps doesn't have a scale bar within the Android SDK.

For our mbgl demo app, the UX team wanted the scale bar to move etc. based on the chrome around the map - so I had to move the compass and add one of our (branded) android scale bars (because gravity alone wasn't going to work).

Slightly topical given mapbox/mapbox-java#131 but we used RXJava to keep the code fairly clean. For example:

mMetersPerPixelObservable.subscribe(mpp -> mScaleBar.setMetersPerPixel(mpp););

@clydebarrow
Copy link
Contributor Author

@snodnipper A valid question and one I had thought about.

Firstly there is definitely some demand for the feature - there is more than one feature request lodged here for something similar, and it was something I kept looking for on my maps.

Originally I implemented it outside the SDK by subclassing Mapview but there were a few details that anyone wanting to use that had to get right to make it work. Nothing show-stopping, but not quite plug and play.

Looking at the SDK it became apparent that there were already models of similar widgets - the compass and the attribution - that the scale bar would sit nicely alongside both in concept and implementation.

Finally, the MAS link you provided illustrates that at present there is, AFAIK, no established framework for stand-alone addons to mapbox. It's not immediately obvious (without reading the source) what that code does and whatever it is, it's just an example, not a plug-and-play widget.

One question I'm ambivalent on is whether the scale bar should be enabled by default (in my PR it is.) On balance I think that's fine, because it enables easy discovery that the feature exists.

@tobrun tobrun mentioned this pull request Oct 4, 2016
@tobrun
Copy link
Member

tobrun commented Oct 4, 2016

Thanks you guys for the remarks, I ticketed the feedback into #6570.

@tobrun
Copy link
Member

tobrun commented Oct 4, 2016

I'm going to add the android-future milestonefor now, we are currently planning a new release and don't want to impact stability by introducing new features at this point. We are currently thinking of merging this once the release lands. Probably in combination with refactoring in #6570. Thanks again for the contribution @clydebarrow!

@tobrun tobrun removed their assignment Oct 4, 2016
@tobrun tobrun added this to the android-future milestone Oct 4, 2016
@1ec5 1ec5 mentioned this pull request Oct 7, 2016
@1ec5 1ec5 added feature GL JS parity For feature parity with Mapbox GL JS labels Feb 15, 2017
@1ec5 1ec5 added this to Needed for Android SDK v5.0.0 in release-ios-v3.5.0-android-v5.0.0 Mar 4, 2017
@tobrun tobrun removed this from the android-v5.0.0 milestone Mar 6, 2017
@1ec5 1ec5 removed this from Needed for Android SDK v5.0.0 in release-ios-v3.5.0-android-v5.0.0 Mar 15, 2017
@tobrun
Copy link
Member

tobrun commented Jan 5, 2018

This is going to be implemented as a plugin in mapbox/mapbox-plugins-android#11

@tobrun tobrun closed this Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature GL JS parity For feature parity with Mapbox GL JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants