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

Forward getMapAsync to map for fragment #9621

Merged
merged 1 commit into from
Jul 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
map.onCreate(savedInstanceState);
if (onMapReadyCallback != null) {
map.getMapAsync(onMapReadyCallback);
}
}

/**
Expand All @@ -85,7 +88,6 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
public void onStart() {
super.onStart();
map.onStart();
map.getMapAsync(onMapReadyCallback);
}

/**
Expand Down Expand Up @@ -150,6 +152,10 @@ public void onDestroyView() {
* @param onMapReadyCallback The callback to be invoked.
*/
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
this.onMapReadyCallback = onMapReadyCallback;
if (map == null) {
this.onMapReadyCallback = onMapReadyCallback;
} else {
map.getMapAsync(onMapReadyCallback);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
map.onCreate(savedInstanceState);
if (onMapReadyCallback != null) {
map.getMapAsync(onMapReadyCallback);
}
}

/**
Expand All @@ -85,7 +88,6 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
public void onStart() {
super.onStart();
map.onStart();
map.getMapAsync(onMapReadyCallback);
}

/**
Expand Down Expand Up @@ -150,6 +152,10 @@ public void onDestroyView() {
* @param onMapReadyCallback The callback to be invoked.
*/
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
this.onMapReadyCallback = onMapReadyCallback;
if (map == null) {
this.onMapReadyCallback = onMapReadyCallback;
} else {
map.getMapAsync(onMapReadyCallback);
}
}
}