@@ -566,36 +566,35 @@ public void updateExtraData(Object extraData) {
566566 }
567567
568568 public void animateToRegion (LatLngBounds bounds , int duration ) {
569- if (map != null ) {
570- map .animateCamera (CameraUpdateFactory .newLatLngBounds (bounds , 0 ), duration , null );
571- }
569+ if (map == null ) return ;
570+ map .animateCamera (CameraUpdateFactory .newLatLngBounds (bounds , 0 ), duration , null );
572571 }
573572
574573 public void animateToViewingAngle (float angle , int duration ) {
575- if (map != null ) {
576- CameraPosition cameraPosition = new CameraPosition . Builder ( map . getCameraPosition ())
577- . tilt ( angle )
578- . build ();
579- map . animateCamera ( CameraUpdateFactory . newCameraPosition ( cameraPosition ), duration , null );
580- }
574+ if (map == null ) return ;
575+
576+ CameraPosition cameraPosition = new CameraPosition . Builder ( map . getCameraPosition () )
577+ . tilt ( angle )
578+ . build ( );
579+ map . animateCamera ( CameraUpdateFactory . newCameraPosition ( cameraPosition ), duration , null );
581580 }
582581
583582 public void animateToBearing (float bearing , int duration ) {
584- if (map != null ) {
585- CameraPosition cameraPosition = new CameraPosition .Builder (map .getCameraPosition ())
586- .bearing (bearing )
587- .build ();
588- map .animateCamera (CameraUpdateFactory .newCameraPosition (cameraPosition ), duration , null );
589- }
583+ if (map == null ) return ;
584+ CameraPosition cameraPosition = new CameraPosition .Builder (map .getCameraPosition ())
585+ .bearing (bearing )
586+ .build ();
587+ map .animateCamera (CameraUpdateFactory .newCameraPosition (cameraPosition ), duration , null );
590588 }
591589
592590 public void animateToCoordinate (LatLng coordinate , int duration ) {
593- if (map != null ) {
594- map .animateCamera (CameraUpdateFactory .newLatLng (coordinate ), duration , null );
595- }
591+ if (map == null ) return ;
592+ map .animateCamera (CameraUpdateFactory .newLatLng (coordinate ), duration , null );
596593 }
597594
598595 public void fitToElements (boolean animated ) {
596+ if (map == null ) return ;
597+
599598 LatLngBounds .Builder builder = new LatLngBounds .Builder ();
600599
601600 boolean addedPosition = false ;
@@ -620,6 +619,8 @@ public void fitToElements(boolean animated) {
620619 }
621620
622621 public void fitToSuppliedMarkers (ReadableArray markerIDsArray , boolean animated ) {
622+ if (map == null ) return ;
623+
623624 LatLngBounds .Builder builder = new LatLngBounds .Builder ();
624625
625626 String [] markerIDs = new String [markerIDsArray .size ()];
@@ -655,6 +656,8 @@ public void fitToSuppliedMarkers(ReadableArray markerIDsArray, boolean animated)
655656
656657 public void fitToCoordinates (ReadableArray coordinatesArray , ReadableMap edgePadding ,
657658 boolean animated ) {
659+ if (map == null ) return ;
660+
658661 LatLngBounds .Builder builder = new LatLngBounds .Builder ();
659662
660663 for (int i = 0 ; i < coordinatesArray .size (); i ++) {
@@ -682,6 +685,8 @@ public void fitToCoordinates(ReadableArray coordinatesArray, ReadableMap edgePad
682685 }
683686
684687 public void setMapBoundaries (ReadableMap northEast , ReadableMap southWest ) {
688+ if (map == null ) return ;
689+
685690 LatLngBounds .Builder builder = new LatLngBounds .Builder ();
686691
687692 Double latNE = northEast .getDouble ("latitude" );
@@ -694,9 +699,7 @@ public void setMapBoundaries(ReadableMap northEast, ReadableMap southWest) {
694699
695700 LatLngBounds bounds = builder .build ();
696701
697- if (map != null ) {
698- map .setLatLngBoundsForCameraTarget (bounds );
699- }
702+ map .setLatLngBoundsForCameraTarget (bounds );
700703 }
701704
702705 // InfoWindowAdapter interface
0 commit comments