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

Remove view tree observer #13133

Merged
merged 1 commit into from
Oct 24, 2018
Merged

Remove view tree observer #13133

merged 1 commit into from
Oct 24, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Oct 18, 2018

This PR removes our view tree observer setup on the MapView initialisation code. This concept was used in the past to make sure the view was measured and that calls to getWidth and getHeight returned not 0 values. With the introduction of async rendering however we introduced the following:

  private void onSurfaceCreated() {
    hasSurface = true;
    post(new Runnable() {
      @Override
      public void run() {
        // Initialise only when not destroyed and only once
        if (!destroyed && mapboxMap == null) {
          MapView.this.initialiseMap();
          mapboxMap.onStart();
        }
      }
    });

Which has the same effect as the ViewTreeObserver setup. It will postpone our setup so components as UiSettings and similar can be initialised with a valid height/width. This change unblocks showing a MapView in a RecyclerView when the item itself isn't visible at Activity start (refs #13132).

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Oct 18, 2018
@tobrun tobrun added this to the android-v6.7.0 milestone Oct 18, 2018
@tobrun tobrun self-assigned this Oct 18, 2018
@tobrun tobrun requested a review from zugaldia October 18, 2018 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants