This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
[android] - add style loading callback - #8291
Merged
tobrun merged 2 commits intoMar 10, 2017
Merged
Conversation
incanus
suggested changes
Mar 6, 2017
| } | ||
| }); | ||
| } | ||
| nativeMapView.setStyleUrl(url); |
Contributor
There was a problem hiding this comment.
Why not call this class's setStyleUrl() in order to gate the native call through fewer (i.e. a single) places?
Contributor
There was a problem hiding this comment.
@incanus That would be a circular reference and would cause a stack overflow
| * <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li> | ||
| * </ul> | ||
| * <p> | ||
| * This method is asynchronous and will return immediately before the style finishes loading. |
Contributor
There was a problem hiding this comment.
This (and the similar comment(s) above) could be worded better—makes it sound like immediately before instead of what actually happens, which is immediately and before the style finishes loading.
| * </ul> | ||
| * <p> | ||
| * This method is asynchronous and will return immediately before the style finishes loading. | ||
| * If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event. |
| public void setStyleUrl(@NonNull final String url, @Nullable final OnStyleLoadedListener callback) { | ||
| if (callback != null) { | ||
| nativeMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { | ||
| @Override |
Contributor
There was a problem hiding this comment.
This could be my Android newbness speaking, but do you need to call the superclass implementation if you are overriding here?
incanus
approved these changes
Mar 6, 2017
Contributor
|
Just my minor comment docs changes above, but this is good to ship. |
…tyle with the default styles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8262.
This PR adds a style loading callback that is invoked when the style has finished loading.