@@ -120,6 +120,7 @@ private void initialise(@NonNull final Context context, @NonNull final MapboxMap
120
120
myLocationView = (MyLocationView ) view .findViewById (R .id .userLocationView );
121
121
attrView = (ImageView ) view .findViewById (R .id .attributionView );
122
122
logoView = (ImageView ) view .findViewById (R .id .logoView );
123
+ mapZoomButtonController = new MapZoomButtonController (new ZoomButtonsController (this ));
123
124
124
125
// add accessibility support
125
126
setContentDescription (context .getString (R .string .mapbox_mapActionDescription ));
@@ -180,7 +181,7 @@ private void initialiseMap() {
180
181
mapKeyListener = new MapKeyListener (transform , trackingSettings , uiSettings );
181
182
182
183
MapZoomControllerListener zoomListener = new MapZoomControllerListener (mapGestureDetector , uiSettings , transform );
183
- mapZoomButtonController = new MapZoomButtonController ( this , uiSettings , zoomListener );
184
+ mapZoomButtonController . bind ( uiSettings , zoomListener );
184
185
185
186
// inject widgets with MapboxMap
186
187
compassView .setMapboxMap (mapboxMap );
@@ -557,9 +558,7 @@ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
557
558
@ CallSuper
558
559
protected void onDetachedFromWindow () {
559
560
super .onDetachedFromWindow ();
560
- if (mapZoomButtonController != null ) {
561
- mapZoomButtonController .setVisible (false );
562
- }
561
+ mapZoomButtonController .setVisible (false );
563
562
}
564
563
565
564
// Called when view is hidden and shown
@@ -569,7 +568,7 @@ protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
569
568
return ;
570
569
}
571
570
572
- if (mapZoomButtonController != null && nativeMapView != null ) {
571
+ if (nativeMapView != null ) {
573
572
mapZoomButtonController .setVisible (visibility == View .VISIBLE );
574
573
}
575
574
}
0 commit comments