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.

Decouple style loading from OnMapReady #12219

Closed

Description

@tobrun

To improve general map initialization time and more specificly map loading time when their isn't an internet connection. We should decouple OnMapReady invocation from the style finished loading event. OnMapReady should be called when the map is ready to render and we should provide a separate callback for when the style has finished loading. This change will require public API changes and will fit in well with the prospoed Style.java refactors in #9338.

wip branch.

Activity

  1. added
    Android
    SEMVER-MAJOR
    on Jun 26, 2018
  2. added this to the milestone on Jun 26, 2018
  3. anandthakker commented on Jun 28, 2018

    @anandthakker
    Contributor

    @tobrun if users are using OnMapReady as a hook for adding new sources/layers to the map via runtime styling, would the change proposed here cause issues where dynamically added layers would be lost after a remote style was finished loading? (Related: #10947)

  4. tobrun commented on Jun 29, 2018

    @tobrun
    MemberAuthor

    Yes, without any additional changes to the api that would result in not having those sources/layers added to the finished loaded style. eg. clustering is not showing up anymore:

    image

    For this reason I would like to include #9338 and refactor the API as:

        mapView.getMapAsync(map -> {
          // we get callback once the native lib has loaded
          map.setStyle(Style.MAPBOX_STREETS, style -> {
            // we get callback once the style has loaded
            style.addSource(new GeoJsonSource(MARKER_SOURCE, markers));
            style.addLayer(
              new SymbolLayer(MARKER_LAYER, MARKER_SOURCE)
            );
          });

    The users won't be able to add sources/layers until the style has finished loading. Above api change would also help with implementing #10947.

  5. removed this from the milestone on Sep 19, 2018
  6. added this to the android-v7.0.0 milestone on Oct 24, 2018
  7. self-assigned this
    on Oct 24, 2018
  8. tobrun commented on Dec 10, 2018

    @tobrun
    MemberAuthor

    done with #13484

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

Metadata

Metadata

Assignees

Labels

AndroidSEMVER-MAJORhigh priority

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions