File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
ApiDemos/kotlin/app/src/gms/java/com/example/kotlindemos Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,15 @@ class OnMapAndViewReadyListener(
5353
5454 private fun registerListeners () {
5555 // View layout.
56- if (mapView?.width != 0 && mapView?.height != 0 ) {
57- // View has already completed layout.
58- isViewReady = true
59- } else {
60- // Map has not undergone layout, register a View observer.
61- mapView.viewTreeObserver.addOnGlobalLayoutListener(this )
56+ mapView?.let {
57+ if (it.width != 0 && it.height != 0 ) {
58+ // View has already completed layout.
59+ isViewReady = true
60+ } else {
61+ // Map has not undergone layout, register a View observer.
62+ it.viewTreeObserver.addOnGlobalLayoutListener(this )
63+ }
6264 }
63-
6465 // GoogleMap. Note if the GoogleMap is already ready it will still fire the callback later.
6566 mapFragment.getMapAsync(this )
6667 }
You can’t perform that action at this time.
0 commit comments