react-native-maps 1.21.0-alpha.55 → 1.21.0-alpha.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +200 -174
  2. package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +3 -0
  3. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +3 -0
  4. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +3 -0
  5. package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +3 -0
  6. package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +3 -0
  7. package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +3 -0
  8. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +3 -0
  9. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +3 -0
  10. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +3 -0
  11. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +3 -0
  12. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +3 -0
  13. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +3 -0
  14. package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +3 -0
  15. package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +3 -0
  16. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +8 -3
  17. package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +3 -0
  18. package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +3 -0
  19. package/android/src/main/java/com/rnmaps/maps/MapView.java +1 -0
  20. package/package.json +1 -1
  21. package/android/src/main/java/com/rnmaps/fabric/MapViewWrapper.java +0 -369
@@ -1,6 +1,8 @@
1
1
  package com.rnmaps.fabric;
2
2
 
3
3
 
4
+ import static com.rnmaps.maps.MapManager.MY_LOCATION_PRIORITY;
5
+
4
6
  import android.util.Log;
5
7
  import android.view.View;
6
8
 
@@ -9,10 +11,12 @@ import androidx.annotation.Nullable;
9
11
 
10
12
  import com.facebook.react.bridge.ReactApplicationContext;
11
13
  import com.facebook.react.bridge.ReadableMap;
12
- import com.facebook.react.bridge.UiThreadUtil;
13
14
  import com.facebook.react.module.annotations.ReactModule;
14
15
  import com.facebook.react.uimanager.LayoutShadowNode;
16
+ import com.facebook.react.uimanager.ReactStylesDiffMap;
17
+ import com.facebook.react.uimanager.StateWrapper;
15
18
  import com.facebook.react.uimanager.ThemedReactContext;
19
+ import com.facebook.react.uimanager.UIManagerHelper;
16
20
  import com.facebook.react.uimanager.ViewGroupManager;
17
21
  import com.facebook.react.uimanager.ViewManagerDelegate;
18
22
  import com.facebook.react.viewmanagers.RNMapsMapViewManagerInterface;
@@ -24,26 +28,23 @@ import com.google.android.gms.maps.model.CameraPosition;
24
28
  import com.rnmaps.maps.MapView;
25
29
  import com.rnmaps.maps.SizeReportingShadowNode;
26
30
 
27
- import java.util.List;
28
31
  import java.util.Map;
29
32
 
30
33
  @ReactModule(name = MapViewManager.REACT_CLASS)
31
- public class MapViewManager extends ViewGroupManager<MapViewWrapper> implements RNMapsMapViewManagerInterface<MapViewWrapper> {
34
+ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsMapViewManagerInterface<MapView> {
32
35
 
33
- private GoogleMapOptions options;
34
- private boolean rendererInitialized = false;
35
- private final RNMapsMapViewManagerDelegate<MapViewWrapper, MapViewManager> delegate =
36
+ private static boolean rendererInitialized = false;
37
+ private final RNMapsMapViewManagerDelegate<MapView, MapViewManager> delegate =
36
38
  new RNMapsMapViewManagerDelegate<>(this);
37
39
 
38
40
 
39
41
  public MapViewManager(ReactApplicationContext context) {
40
42
  super(context);
41
- options = new GoogleMapOptions();
42
43
  }
43
44
 
44
45
 
45
46
  @Override
46
- public ViewManagerDelegate<MapViewWrapper> getDelegate() {
47
+ public ViewManagerDelegate<MapView> getDelegate() {
47
48
  return delegate;
48
49
  }
49
50
 
@@ -53,9 +54,91 @@ public class MapViewManager extends ViewGroupManager<MapViewWrapper> implements
53
54
  }
54
55
 
55
56
  @Override
56
- public MapViewWrapper createViewInstance(ThemedReactContext context) {
57
- Log.e(MapViewManager.class.getName(), "createViewInstance");
58
- return new MapViewWrapper(context);
57
+ public MapView createViewInstance(ThemedReactContext context) {
58
+ return new MapView(context, new GoogleMapOptions());
59
+ }
60
+
61
+ @Override
62
+ protected void setupViewRecycling() {
63
+ // override parent to block recycling / allow reliable GoogleMapsOptions passing
64
+ }
65
+
66
+ private GoogleMapOptions optionsForInitialProps(ReactStylesDiffMap initialProps){
67
+ GoogleMapOptions options = new GoogleMapOptions();
68
+ if (initialProps != null) {
69
+ setGoogleRenderer(null, initialProps.getString("googleRenderer"));
70
+ if (initialProps.hasKey("liteMode")) {
71
+ options.liteMode(initialProps.getBoolean("liteMode", false));
72
+ }
73
+ if (initialProps.hasKey("googleMapId")) {
74
+ String googleMapId = initialProps.getString("googleMapId");
75
+ options.mapId(googleMapId);
76
+ }
77
+ if (initialProps.getMap("initialCamera") != null) {
78
+ ReadableMap initialCamera = initialProps.getMap("initialCamera");
79
+ CameraPosition camera = MapView.cameraPositionFromMap(initialCamera);
80
+ if (camera != null) {
81
+ options.camera(camera);
82
+ }
83
+ }
84
+ if (initialProps.hasKey("mapType")) {
85
+ if (initialProps.getString("mapType") != null) {
86
+ options.mapType(mapTypeFromStrValue(initialProps.getString("mapType")));
87
+ }
88
+ }
89
+ if (initialProps.hasKey("minZoom")) {
90
+ if (initialProps.getInt("minZoom", 0) != 0) {
91
+ options.minZoomPreference(initialProps.getInt("minZoom", 0));
92
+ }
93
+ }
94
+ if (initialProps.hasKey("maxZoom")) {
95
+ if (initialProps.getInt("maxZoom", 0) != 0) {
96
+ options.maxZoomPreference(initialProps.getInt("maxZoom", 0));
97
+ }
98
+ }
99
+ if (initialProps.hasKey("pitchEnabled")) {
100
+ options.tiltGesturesEnabled(initialProps.getBoolean("pitchEnabled", true));
101
+ }
102
+ if (initialProps.hasKey("rotateEnabled")) {
103
+ options.rotateGesturesEnabled(initialProps.getBoolean("rotateEnabled", true));
104
+ }
105
+ if (initialProps.hasKey("scrollDuringRotateOrZoomEnabled")) {
106
+ options.scrollGesturesEnabledDuringRotateOrZoom(initialProps.getBoolean("scrollDuringRotateOrZoomEnabled", true));
107
+ }
108
+ if (initialProps.hasKey("scrollEnabled")) {
109
+ options.scrollGesturesEnabled(initialProps.getBoolean("scrollEnabled", true));
110
+ }
111
+ if (initialProps.hasKey("showsCompass")) {
112
+ options.compassEnabled(initialProps.getBoolean("showsCompass", true));
113
+ }
114
+ if (initialProps.hasKey("toolbarEnabled")) {
115
+ options.mapToolbarEnabled(initialProps.getBoolean("toolbarEnabled", true));
116
+ }
117
+ if (initialProps.hasKey("zoomControlEnabled")) {
118
+ options.zoomControlsEnabled(initialProps.getBoolean("zoomControlEnabled", true));
119
+ }
120
+ if (initialProps.hasKey("zoomEnabled")) {
121
+ options.zoomGesturesEnabled(initialProps.getBoolean("zoomEnabled", true));
122
+ }
123
+ }
124
+ return options;
125
+ }
126
+ @Override
127
+ protected MapView createViewInstance(int reactTag, @NonNull ThemedReactContext reactContext, @Nullable ReactStylesDiffMap initialProps, @Nullable StateWrapper stateWrapper) {
128
+ MapView view = null;
129
+ view = new MapView(reactContext, optionsForInitialProps(initialProps));
130
+ view.setId(reactTag);
131
+ this.addEventEmitters(reactContext, view);
132
+ if (initialProps != null) {
133
+ this.updateProperties(view, initialProps);
134
+ }
135
+ if (stateWrapper != null) {
136
+ Object extraData = this.updateState(view, initialProps, stateWrapper);
137
+ if (extraData != null) {
138
+ this.updateExtraData(view, extraData);
139
+ }
140
+ }
141
+ return view;
59
142
  }
60
143
 
61
144
 
@@ -82,76 +165,69 @@ public class MapViewManager extends ViewGroupManager<MapViewWrapper> implements
82
165
  }
83
166
 
84
167
  @Override
85
- public void setCacheEnabled(MapViewWrapper view, boolean value) {
168
+ public void setCacheEnabled(MapView view, boolean value) {
86
169
  view.setCacheEnabled(value);
87
170
  }
88
171
 
89
172
  @Override
90
- public void setCamera(MapViewWrapper view, @Nullable ReadableMap value) {
173
+ public void setCamera(MapView view, @Nullable ReadableMap value) {
91
174
  view.setCamera(value);
92
175
  }
93
176
 
94
177
  @Override
95
- public void setCompassOffset(MapViewWrapper view, @Nullable ReadableMap value) {
178
+ public void setCompassOffset(MapView view, @Nullable ReadableMap value) {
96
179
  // not supported
97
180
  }
98
181
 
99
182
  @Override
100
- public void setFollowsUserLocation(MapViewWrapper view, boolean value) {
183
+ public void setFollowsUserLocation(MapView view, boolean value) {
101
184
  // not supported
102
185
  }
103
186
 
104
187
  @Override
105
- public void setPoiClickEnabled(MapViewWrapper view, boolean value) {
188
+ public void setPoiClickEnabled(MapView view, boolean value) {
106
189
  view.setPoiClickEnabled(value);
107
190
  }
108
191
 
109
192
  @Override
110
- public void setInitialCamera(MapViewWrapper view, @Nullable ReadableMap value) {
193
+ public void setInitialCamera(MapView view, @Nullable ReadableMap value) {
111
194
  CameraPosition camera = MapView.cameraPositionFromMap(value);
112
- if (camera != null){
113
- options.camera(camera);
195
+ if (camera != null) {
114
196
  view.setInitialCameraSet(true);
115
197
  }
116
198
  }
117
199
 
118
- @Override
119
- protected MapViewWrapper recycleView(@NonNull ThemedReactContext var1, @NonNull MapViewWrapper wrapper){
120
- wrapper.prepareToRecycleView();
121
- return wrapper;
122
- }
123
-
124
200
 
125
201
  @Override
126
- public void setInitialRegion(MapViewWrapper view, @Nullable ReadableMap value) {
202
+ public void setInitialRegion(MapView view, @Nullable ReadableMap value) {
127
203
  view.setInitialRegion(value);
128
204
  }
129
205
 
130
206
  @Override
131
- public void setKmlSrc(MapViewWrapper view, @Nullable String value) {
207
+ public void setKmlSrc(MapView view, @Nullable String value) {
132
208
  view.setKmlSrc(value);
133
209
  }
134
210
 
135
211
  @Override
136
- public void setLegalLabelInsets(MapViewWrapper view, @Nullable ReadableMap value) {
212
+ public void setLegalLabelInsets(MapView view, @Nullable ReadableMap value) {
137
213
  // not supported
138
214
  }
139
215
 
140
216
  @Override
141
- public void setLiteMode(MapViewWrapper view, boolean value) {
142
- options.liteMode(value);
217
+ public void setLiteMode(MapView view, boolean value) {
218
+ // do nothing (initialProp)
143
219
  }
144
220
 
145
221
  @Override
146
- public void setGoogleMapId(MapViewWrapper view, @Nullable String value) {
147
- options.mapId(value);
222
+ public void setGoogleMapId(MapView view, @Nullable String value) {
223
+ // do nothing (initialProp)
148
224
  }
149
225
 
150
226
  @Override
151
- public void setGoogleRenderer(MapViewWrapper view, @Nullable String value) {
227
+ public void setGoogleRenderer(MapView view, @Nullable String value) {
152
228
  if (!rendererInitialized) {
153
- MapsInitializer.Renderer renderer = MapsInitializer.Renderer.LATEST;
154
- if ("LEGACY".equals(value)){
229
+ MapsInitializer.Renderer renderer = MapsInitializer.Renderer.LATEST;
230
+ if ("LEGACY".equals(value)) {
155
231
  renderer = MapsInitializer.Renderer.LEGACY;
156
232
  }
157
233
  MapsInitializer.initialize(getReactApplicationContext(), renderer, r -> Log.d("AirMapRenderer", "Init with renderer: " + r));
@@ -161,43 +237,61 @@ public class MapViewManager extends ViewGroupManager<MapViewWrapper> implements
161
237
  }
162
238
 
163
239
  @Override
164
- public void setLoadingBackgroundColor(MapViewWrapper view, @Nullable Integer value) {
240
+ public void setLoadingBackgroundColor(MapView view, @Nullable Integer value) {
165
241
  view.setLoadingBackgroundColor(value);
166
242
  }
167
243
 
168
244
  @Override
169
- public void setLoadingEnabled(MapViewWrapper view, boolean value) {
245
+ public void setLoadingEnabled(MapView view, boolean value) {
170
246
  view.setLoadingEnabled(value);
171
247
  }
172
248
 
173
249
  @Override
174
- public void setLoadingIndicatorColor(MapViewWrapper view, @Nullable Integer value) {
250
+ public void setLoadingIndicatorColor(MapView view, @Nullable Integer value) {
175
251
  view.setLoadingIndicatorColor(value);
176
252
  }
177
253
 
178
254
  @Override
179
- public void setMapPadding(MapViewWrapper view, @Nullable ReadableMap padding) {
180
- view.setMapPadding(padding);
181
- }
255
+ public void setMapPadding(MapView view, @Nullable ReadableMap padding) {
256
+ int left = 0;
257
+ int top = 0;
258
+ int right = 0;
259
+ int bottom = 0;
260
+ double density = (double) view.getResources().getDisplayMetrics().density;
182
261
 
183
- @Override
184
- public void addView(MapViewWrapper parent, View child, int index) {
185
- parent.getMapView().addFeature(child, index);
186
- Log.e("MapViewManager", "addView " + child.getId() + " at index: " + index);
262
+ if (padding != null) {
263
+ if (padding.hasKey("left")) {
264
+ left = (int) (padding.getDouble("left") * density);
265
+ }
187
266
 
188
- }
189
- @Override
190
- public void addViews(MapViewWrapper parent, List<View> views){
191
- for (View view : views){
192
- parent.getMapView().addView(view);
193
- Log.e("MapViewManager", "addViews " + view.getId());
267
+ if (padding.hasKey("top")) {
268
+ top = (int) (padding.getDouble("top") * density);
269
+ }
270
+
271
+ if (padding.hasKey("right")) {
272
+ right = (int) (padding.getDouble("right") * density);
273
+ }
274
+
275
+ if (padding.hasKey("bottom")) {
276
+ bottom = (int) (padding.getDouble("bottom") * density);
277
+ }
194
278
  }
195
279
 
280
+ view.applyBaseMapPadding(left, top, right, bottom);
281
+ view.map.setPadding(left, top, right, bottom);
196
282
  }
197
283
 
284
+ @Override
285
+ public void addView(MapView parent, View child, int index) {
286
+ parent.addFeature(child, index);
287
+ }
198
288
 
199
289
  @Override
200
- public void setMapType(MapViewWrapper view, @Nullable String value) {
290
+ public void setMapType(MapView view, @Nullable String value) {
291
+ view.setMapType(mapTypeFromStrValue(value));
292
+ }
293
+
294
+ private static int mapTypeFromStrValue(String value) {
201
295
  int mapType;
202
296
  //hybrid | none | satellite | standard | terrain
203
297
  if ("hybrid".equals(value)) {
@@ -211,267 +305,199 @@ public class MapViewManager extends ViewGroupManager<MapViewWrapper> implements
211
305
  } else if ("terrain".equals(value)) {
212
306
  mapType = GoogleMap.MAP_TYPE_TERRAIN;
213
307
  } else {
214
- mapType = GoogleMap.MAP_TYPE_NORMAL;
215
- }
216
- options.mapType(mapType);
217
- if (view.getMapView() != null){
218
- view.getMapView().setMapType(mapType);
308
+ mapType = GoogleMap.MAP_TYPE_NORMAL;
219
309
  }
310
+ return mapType;
220
311
  }
221
312
 
222
313
  @Override
223
- public void setMaxDelta(MapViewWrapper view, double value) {
314
+ public void setMaxDelta(MapView view, double value) {
224
315
  // not supported
225
316
  }
226
317
 
227
318
  @Override
228
- public void setMaxZoom(MapViewWrapper view, float value) {
229
- options.maxZoomPreference(value);
230
- if (view.getMapView() != null) {
231
- view.getMapView().setMaxZoomLevel(value);
232
- }
319
+ public void setMaxZoom(MapView view, float value) {
320
+ view.setMaxZoomLevel(value);
233
321
  }
234
322
 
235
323
  @Override
236
- public void setMinDelta(MapViewWrapper view, double value) {
324
+ public void setMinDelta(MapView view, double value) {
237
325
  // not supported
238
326
  }
239
327
 
240
328
  @Override
241
- public void setMinZoom(MapViewWrapper view, float value) {
242
- options.minZoomPreference(value);
243
- if (view.getMapView() != null) {
244
- view.getMapView().setMinZoomLevel(value);
245
- }
329
+ public void setMinZoom(MapView view, float value) {
330
+ view.setMinZoomLevel(value);
246
331
  }
247
332
 
248
333
  @Override
249
- public void setMoveOnMarkerPress(MapViewWrapper view, boolean value) {
250
- view.setMoveOnMarkerPress(value);
334
+ public void setMoveOnMarkerPress(MapView view, boolean value) {
335
+ view.setMoveOnMarkerPress(value);
251
336
  }
252
337
 
253
338
  @Override
254
- public void setHandlePanDrag(MapViewWrapper view, boolean value) {
339
+ public void setHandlePanDrag(MapView view, boolean value) {
255
340
  view.setHandlePanDrag(value);
256
341
  }
257
342
 
258
343
  @Override
259
- public void setPaddingAdjustmentBehavior(MapViewWrapper view, @Nullable String value) {
344
+ public void setPaddingAdjustmentBehavior(MapView view, @Nullable String value) {
260
345
  // not supported
261
346
  }
262
347
 
263
348
  @Override
264
- public void setPitchEnabled(MapViewWrapper view, boolean value) {
265
- options.tiltGesturesEnabled(value);
266
- if (view.getMapView() != null) {
267
- view.getMapView().setPitchEnabled(value);
268
- }
349
+ public void setPitchEnabled(MapView view, boolean value) {
350
+ view.setPitchEnabled(value);
269
351
  }
270
352
 
271
353
  @Override
272
- public void setRegion(MapViewWrapper view, @Nullable ReadableMap value) {
354
+ public void setRegion(MapView view, @Nullable ReadableMap value) {
273
355
  view.setRegion(value);
274
356
  }
275
357
 
276
358
  @Override
277
- public void setRotateEnabled(MapViewWrapper view, boolean value) {
278
- options.rotateGesturesEnabled(value);
279
- if (view.getMapView() != null) {
280
- view.getMapView().setRotateEnabled(value);
281
- }
359
+ public void setRotateEnabled(MapView view, boolean value) {
360
+ view.setRotateEnabled(value);
282
361
  }
283
362
 
284
363
  @Override
285
- public void setScrollDuringRotateOrZoomEnabled(MapViewWrapper view, boolean value) {
286
- options.scrollGesturesEnabledDuringRotateOrZoom(value);
287
- if (view.getMapView() != null) {
288
- view.getMapView().setScrollDuringRotateOrZoomEnabled(value);
289
- }
364
+ public void setScrollDuringRotateOrZoomEnabled(MapView view, boolean value) {
365
+ view.setScrollDuringRotateOrZoomEnabled(value);
290
366
  }
291
367
 
292
368
  @Override
293
- public void setScrollEnabled(MapViewWrapper view, boolean value) {
294
- options.scrollGesturesEnabled(value);
295
- if (view.getMapView() != null) {
296
- view.getMapView().setScrollEnabled(value);
297
- }
369
+ public void setScrollEnabled(MapView view, boolean value) {
370
+ view.setScrollEnabled(value);
298
371
  }
299
372
 
300
373
  @Override
301
- public void setShowsBuildings(MapViewWrapper view, boolean value) {
302
- view.setShowsBuildings(value);
374
+ public void setShowsBuildings(MapView view, boolean value) {
375
+ view.setShowBuildings(value);
303
376
  }
304
377
 
305
378
  @Override
306
- public void setShowsCompass(MapViewWrapper view, boolean value) {
307
- options.compassEnabled(value);
379
+ public void setShowsCompass(MapView view, boolean value) {
308
380
  view.setShowsCompass(value);
309
381
  }
310
382
 
311
383
  @Override
312
- public void setShowsIndoorLevelPicker(MapViewWrapper view, boolean value) {
384
+ public void setShowsIndoorLevelPicker(MapView view, boolean value) {
313
385
  view.setShowsIndoorLevelPicker(value);
314
386
  }
315
387
 
316
388
  @Override
317
- public void setShowsIndoors(MapViewWrapper view, boolean value) {
318
- view.setShowsIndoors(value);
389
+ public void setShowsIndoors(MapView view, boolean value) {
390
+ view.setShowIndoors(value);
319
391
  }
320
392
 
321
393
  @Override
322
- public void setShowsMyLocationButton(MapViewWrapper view, boolean value) {
394
+ public void setShowsMyLocationButton(MapView view, boolean value) {
323
395
  view.setShowsMyLocationButton(value);
324
396
  }
325
397
 
326
398
  @Override
327
- public void setShowsScale(MapViewWrapper view, boolean value) {
399
+ public void setShowsScale(MapView view, boolean value) {
328
400
  // not supported
329
401
  }
330
402
 
331
403
  @Override
332
- public void setShowsUserLocation(MapViewWrapper view, boolean value) {
404
+ public void setShowsUserLocation(MapView view, boolean value) {
333
405
  view.setShowsUserLocation(value);
334
406
  }
335
407
 
336
408
  @Override
337
- public void setTintColor(MapViewWrapper view, @Nullable Integer value) {
409
+ public void setTintColor(MapView view, @Nullable Integer value) {
338
410
  // not supported
339
411
  }
340
412
 
341
413
  @Override
342
- public void setToolbarEnabled(MapViewWrapper view, boolean value) {
343
- options.mapToolbarEnabled(value);
344
- if (view.getMapView() != null) {
345
- view.getMapView().setToolbarEnabled(value);
346
- }
414
+ public void setToolbarEnabled(MapView view, boolean value) {
415
+ view.setToolbarEnabled(value);
347
416
  }
348
417
 
349
418
  @Override
350
- public void setUserInterfaceStyle(MapViewWrapper view, @Nullable String value) {
419
+ public void setUserInterfaceStyle(MapView view, @Nullable String value) {
351
420
  // todo update google maps SDK and add support for MapColorScheme
352
421
  }
353
422
 
354
423
  @Override
355
- public void setUserLocationAnnotationTitle(MapViewWrapper view, @Nullable String value) {
424
+ public void setUserLocationAnnotationTitle(MapView view, @Nullable String value) {
356
425
  // not supported
357
426
  }
358
427
 
359
428
  @Override
360
- public void setUserLocationCalloutEnabled(MapViewWrapper view, boolean value) {
429
+ public void setUserLocationCalloutEnabled(MapView view, boolean value) {
361
430
  // not supported
362
431
  }
363
432
 
364
433
  @Override
365
- public void setUserLocationFastestInterval(MapViewWrapper view, int value) {
434
+ public void setUserLocationFastestInterval(MapView view, int value) {
366
435
  view.setUserLocationFastestInterval(value);
367
436
  }
368
437
 
369
438
  @Override
370
- public void setUserLocationPriority(MapViewWrapper view, @Nullable String value) {
371
- view.setUserLocationPriority(value);
439
+ public void setUserLocationPriority(MapView view, @Nullable String value) {
440
+ view.setUserLocationPriority(MY_LOCATION_PRIORITY.get(value));
372
441
  }
373
442
 
374
443
  @Override
375
- public void setUserLocationUpdateInterval(MapViewWrapper view, int value) {
444
+ public void setUserLocationUpdateInterval(MapView view, int value) {
376
445
  view.setUserLocationUpdateInterval(value);
377
446
  }
378
447
 
379
448
  @Override
380
- public void setZoomControlEnabled(MapViewWrapper view, boolean value) {
381
- options.zoomControlsEnabled(value);
382
- if (view.getMapView() != null) {
383
- view.setZoomControlEnabled(value);
384
- }
449
+ public void setZoomControlEnabled(MapView view, boolean value) {
450
+ view.setZoomControlEnabled(value);
385
451
  }
386
452
 
387
453
  @Override
388
- public void setZoomEnabled(MapViewWrapper view, boolean value) {
389
- options.zoomGesturesEnabled(value);
390
- if (view.getMapView() != null) {
391
- view.setZoomEnabled(value);
392
- }
454
+ public void setZoomEnabled(MapView view, boolean value) {
455
+ view.setZoomEnabled(value);
393
456
  }
394
457
 
395
458
  @Override
396
- public void setZoomTapEnabled(MapViewWrapper view, boolean value) {
459
+ public void setZoomTapEnabled(MapView view, boolean value) {
397
460
  // not supported
398
461
  }
399
462
 
400
463
  @Override
401
- public void setCameraZoomRange(MapViewWrapper view, @Nullable ReadableMap value) {
464
+ public void setCameraZoomRange(MapView view, @Nullable ReadableMap value) {
402
465
  // not supported
403
466
  }
404
467
 
405
468
  @Override
406
- public void animateToRegion(MapViewWrapper view, String regionJSON, int duration) {
469
+ public void animateToRegion(MapView view, String regionJSON, int duration) {
407
470
 
408
471
  }
409
472
 
410
473
  @Override
411
- public void setCamera(MapViewWrapper view, String cameraJSON) {
474
+ public void setCamera(MapView view, String cameraJSON) {
412
475
 
413
476
  }
414
477
 
415
478
  @Override
416
- public void animateCamera(MapViewWrapper view, String cameraJSON, int duration) {
479
+ public void animateCamera(MapView view, String cameraJSON, int duration) {
417
480
 
418
481
  }
419
482
 
420
483
  @Override
421
- public void fitToElements(MapViewWrapper view, String edgePaddingJSON, boolean animated) {
484
+ public void fitToElements(MapView view, String edgePaddingJSON, boolean animated) {
422
485
 
423
486
  }
424
487
 
425
488
  @Override
426
- public void fitToSuppliedMarkers(MapViewWrapper view, String markersJSON, String edgePaddingJSON, boolean animated) {
489
+ public void fitToSuppliedMarkers(MapView view, String markersJSON, String edgePaddingJSON, boolean animated) {
427
490
 
428
491
  }
429
492
 
430
493
  @Override
431
- public void fitToCoordinates(MapViewWrapper view, String coordinatesJSON, String edgePaddingJSON, boolean animated) {
494
+ public void fitToCoordinates(MapView view, String coordinatesJSON, String edgePaddingJSON, boolean animated) {
432
495
 
433
496
  }
434
- @Override
435
- public int getChildCount(MapViewWrapper parent) {
436
- if (parent.getMapView() != null) {
437
- return parent.getMapView().getChildCount();
438
- }
439
- return 0;
440
- }
441
497
 
442
498
  @Override
443
- public View getChildAt(MapViewWrapper parent, int index) {
444
- if (parent.getMapView() != null) {
445
- return parent.getMapView().getChildAt(index);
446
- }
447
- return null;
448
- }
449
-
450
- @Override
451
- public void removeViewAt(MapViewWrapper parent, int index) {
452
- if (parent.getMapView() != null) {
453
- parent.getMapView().removeViewAt(index);
454
- }
455
- }
456
-
457
- public void removeView(MapViewWrapper parent, View view) {
458
- if (parent.getMapView() != null) {
459
- parent.getMapView().removeView(view);
460
- }
461
- }
462
-
463
-
464
- @Override
465
- protected void onAfterUpdateTransaction(@NonNull MapViewWrapper view) {
466
- super.onAfterUpdateTransaction(view);
467
- setGoogleRenderer(view, null);
468
- view.initializeMapView(options);
469
- options = new GoogleMapOptions();
470
- Log.e("MapViewManager", "onAfterUpdateTransaction tag: " + view.getId());
471
- }
472
- @Override
473
- public void onDropViewInstance(MapViewWrapper view) {
499
+ public void onDropViewInstance(MapView view) {
474
500
  super.onDropViewInstance(view);
475
- view.prepareToRecycleView();
501
+ view.onDestroy();
476
502
  }
477
503
  }
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnDeselectEvent extends Event<OnDeselectEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnDragEndEvent extends Event<OnDragEndEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnDragEvent extends Event<OnDragEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnDragStartEvent extends Event<OnDragStartEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnLongPressEvent extends Event<OnLongPressEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -14,6 +16,7 @@ public class OnMapReadyEvent extends Event<OnMapReadyEvent> {
14
16
  this.payload = payload;
15
17
  }
16
18
 
19
+ @NonNull
17
20
  @Override
18
21
  public String getEventName() {
19
22
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerDeselectEvent extends Event<OnMarkerDeselectEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerDragEndEvent extends Event<OnMarkerDragEndEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerDragEvent extends Event<OnMarkerDragEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerDragStartEvent extends Event<OnMarkerDragStartEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerPressEvent extends Event<OnMarkerPressEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnMarkerSelectEvent extends Event<OnMarkerSelectEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -12,6 +14,7 @@ public class OnPoiClickEvent extends Event<OnPoiClickEvent> {
12
14
  this.payload = payload;
13
15
  }
14
16
 
17
+ @NonNull
15
18
  @Override
16
19
  public String getEventName() {
17
20
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -12,6 +14,7 @@ public class OnPressEvent extends Event<OnPressEvent> {
12
14
  this.payload = payload;
13
15
  }
14
16
 
17
+ @NonNull
15
18
  @Override
16
19
  public String getEventName() {
17
20
  return EVENT_NAME;
@@ -1,5 +1,8 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.ReadableMap;
3
6
  import com.facebook.react.bridge.WritableMap;
4
7
  import com.facebook.react.bridge.WritableNativeMap;
5
8
  import com.facebook.react.uimanager.events.Event;
@@ -7,7 +10,7 @@ import com.google.android.gms.maps.model.LatLng;
7
10
  import com.google.android.gms.maps.model.LatLngBounds;
8
11
 
9
12
  public class OnRegionChangeEvent extends Event<OnRegionChangeEvent> {
10
- public static final String EVENT_NAME = "topChange";
13
+ public static final String EVENT_NAME = "topRegionChange";
11
14
 
12
15
  private final WritableMap payload;
13
16
 
@@ -30,14 +33,16 @@ public class OnRegionChangeEvent extends Event<OnRegionChangeEvent> {
30
33
  return event;
31
34
  }
32
35
 
36
+ @NonNull
33
37
  @Override
34
38
  public String getEventName() {
35
39
  return EVENT_NAME;
36
40
  }
37
41
 
42
+
38
43
  @Override
39
- public boolean canCoalesce() {
40
- return false;
44
+ protected WritableMap getEventData() {
45
+ return payload;
41
46
  }
42
47
 
43
48
  }
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnSelectEvent extends Event<OnSelectEvent> {
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -1,5 +1,7 @@
1
1
  package com.rnmaps.fabric.event;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.facebook.react.bridge.WritableMap;
4
6
  import com.facebook.react.uimanager.events.Event;
5
7
 
@@ -13,6 +15,7 @@ public class OnUserLocationChangeEvent extends Event<OnUserLocationChangeEvent>
13
15
  this.payload = payload;
14
16
  }
15
17
 
18
+ @NonNull
16
19
  @Override
17
20
  public String getEventName() {
18
21
  return EVENT_NAME;
@@ -465,6 +465,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
465
465
  map.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() {
466
466
  @Override
467
467
  public void onCameraMove() {
468
+ Log.e("MapView", "onCameraMove");
468
469
  LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
469
470
 
470
471
  cameraLastIdleBounds = null;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "lib/index.js",
6
6
  "author": "Leland Richardson <leland.m.richardson@gmail.com>",
7
7
  "homepage": "https://github.com/react-native-maps/react-native-maps#readme",
8
- "version": "1.21.0-alpha.55",
8
+ "version": "1.21.0-alpha.57",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
@@ -1,369 +0,0 @@
1
- package com.rnmaps.fabric;
2
-
3
- import static com.rnmaps.maps.MapManager.MY_LOCATION_PRIORITY;
4
-
5
- import android.annotation.SuppressLint;
6
- import android.content.Context;
7
- import android.view.View;
8
- import android.widget.FrameLayout;
9
-
10
- import androidx.annotation.NonNull;
11
- import androidx.annotation.Nullable;
12
-
13
- import com.facebook.react.bridge.ReadableMap;
14
- import com.facebook.react.uimanager.ThemedReactContext;
15
- import com.google.android.gms.maps.GoogleMapOptions;
16
- import com.rnmaps.maps.MapView;
17
-
18
- @SuppressLint("ViewConstructor")
19
- public class MapViewWrapper extends FrameLayout {
20
- private MapView mapView;
21
- private Boolean cacheEnabled;
22
- private Boolean initialCameraSet;
23
-
24
- private Boolean showsBuildings;
25
- private Boolean poiClickEnabled;
26
- private Boolean moveOnMarkerPress;
27
- private Boolean handlePanDrag;
28
- private Boolean showsIndoorLevelPicker;
29
- private Boolean showIndoors;
30
- private Boolean showsMyLocationButton;
31
- private Boolean showsUserLocation;
32
- private Boolean loadingEnabled;
33
-
34
- private ReadableMap camera;
35
-
36
- private ReadableMap initialRegion;
37
-
38
- private String kmlSrc;
39
- private ReadableMap region;
40
- private ReadableMap mapPadding;
41
-
42
- private Integer userLocationPriority;
43
- private Integer userLocationFastestInterval;
44
- private Integer userLocationUpdateInterval;
45
- private Integer loadingIndicatorColor;
46
-
47
-
48
- public MapViewWrapper(@NonNull Context context) {
49
- super(context);
50
- setLayoutParams(new LayoutParams(
51
- LayoutParams.MATCH_PARENT,
52
- LayoutParams.MATCH_PARENT
53
- ));
54
- }
55
-
56
-
57
- public MapView getMapView() {
58
- return mapView;
59
- }
60
- public void initializeMapView(GoogleMapOptions options) {
61
- if (mapView == null) {
62
- mapView = new MapView((ThemedReactContext) getContext(), options);
63
- mapView.setLayoutParams(new LayoutParams(
64
- LayoutParams.MATCH_PARENT,
65
- LayoutParams.MATCH_PARENT
66
- ));
67
- addView(mapView);
68
- if (cacheEnabled != null){
69
- setCacheEnabled(cacheEnabled);
70
- }
71
- if (showsBuildings != null){
72
- setShowsBuildings(showsBuildings);
73
- }
74
- if (poiClickEnabled != null){
75
- setPoiClickEnabled(poiClickEnabled);
76
- }
77
- if (moveOnMarkerPress != null){
78
- setMoveOnMarkerPress(moveOnMarkerPress);
79
- }
80
- if (handlePanDrag != null){
81
- setHandlePanDrag(handlePanDrag);
82
- }
83
- if (showsIndoorLevelPicker != null){
84
- setShowsIndoorLevelPicker(showsIndoorLevelPicker);
85
- }
86
- if (showIndoors != null){
87
- setShowsIndoors(showIndoors);
88
- }
89
-
90
- if (showsMyLocationButton != null){
91
- setShowsMyLocationButton(showsMyLocationButton);
92
- }
93
- if (showsUserLocation != null) {
94
- setShowsUserLocation(showsUserLocation);
95
- }
96
- if (loadingEnabled != null) {
97
- setLoadingEnabled(loadingEnabled);
98
- }
99
- if (camera != null){
100
- setCamera(camera);
101
- }
102
- if (kmlSrc != null){
103
- setKmlSrc(kmlSrc);
104
- }
105
- if (region != null){
106
- setRegion(region);
107
- }
108
- if (mapPadding != null){
109
- setMapPadding(mapPadding);
110
- }
111
- if (userLocationPriority != null) {
112
- mapView.setUserLocationPriority(userLocationPriority);
113
- }
114
- if (userLocationFastestInterval != null) {
115
- setUserLocationFastestInterval(userLocationFastestInterval);
116
- }
117
- if (userLocationUpdateInterval != null) {
118
- setUserLocationUpdateInterval(userLocationUpdateInterval);
119
- }
120
- if (loadingIndicatorColor != null) {
121
- setLoadingIndicatorColor(loadingIndicatorColor);
122
- }
123
- if (initialRegion != null){
124
- mapView.setInitialRegion(initialRegion);
125
- }
126
- if (initialCameraSet != null){
127
- mapView.setInitialCameraSet(initialCameraSet);
128
- }
129
- }
130
- }
131
-
132
- protected void onDetachedFromWindow() {
133
- super.onDetachedFromWindow();
134
- if (mapView != null) {
135
- mapView.onDestroy();
136
- removeView(mapView);
137
- mapView = null;
138
- }
139
- }
140
-
141
- public void setInitialCameraSet(boolean initialCameraSet) {
142
- this.initialCameraSet = initialCameraSet;
143
- }
144
-
145
- public void setInitialRegion(ReadableMap initialRegion) {
146
- this.initialRegion = initialRegion;
147
- if (getMapView() != null){
148
- getMapView().setInitialRegion(initialRegion);
149
- }
150
- }
151
-
152
- public void setCacheEnabled(boolean value) {
153
- if (getMapView() != null) {
154
- getMapView().setCacheEnabled(value);
155
- } else {
156
- cacheEnabled = value;
157
- }
158
- }
159
-
160
-
161
- public void setCamera(@Nullable ReadableMap value) {
162
- if (getMapView() != null) {
163
- getMapView().setCamera(value);
164
- } else {
165
- camera = value;
166
- }
167
- }
168
-
169
-
170
- public void setPoiClickEnabled(boolean value) {
171
- if (getMapView() != null) {
172
- getMapView().setPoiClickEnabled(value);
173
- } else {
174
- poiClickEnabled = value;
175
- }
176
- }
177
-
178
- public void prepareToRecycleView(){
179
- mapView = null;
180
- cacheEnabled = null;
181
- initialCameraSet = null;
182
- showsBuildings = null;
183
- poiClickEnabled = null;
184
- moveOnMarkerPress = null;
185
- handlePanDrag = null;
186
- showsIndoorLevelPicker = null;
187
- showIndoors = null;
188
- showsMyLocationButton = null;
189
- showsUserLocation = null;
190
- loadingEnabled = null;
191
- camera = null;
192
- initialRegion = null;
193
- userLocationPriority = null;
194
- userLocationFastestInterval = null;
195
- userLocationUpdateInterval = null;
196
- loadingIndicatorColor = null;
197
- if (getMapView() != null) {
198
- getMapView().onDestroy();
199
- }
200
- mapView = null;
201
- }
202
-
203
-
204
-
205
- public void setKmlSrc(@Nullable String value) {
206
- if (getMapView() != null) {
207
- getMapView().setKmlSrc(value);
208
- }
209
- kmlSrc = value;
210
- }
211
-
212
-
213
- public void setLoadingBackgroundColor(@Nullable Integer value) {
214
- getMapView().setLoadingBackgroundColor(value);
215
- }
216
-
217
-
218
- public void setLoadingEnabled(boolean value) {
219
- if (getMapView() != null) {
220
- getMapView().setLoadingEnabled(value);
221
- }
222
- loadingEnabled = value;
223
- }
224
-
225
-
226
- public void setLoadingIndicatorColor(@Nullable Integer value) {
227
- if (getMapView() != null) {
228
- getMapView().setLoadingIndicatorColor(value);
229
- }
230
- loadingIndicatorColor = value;
231
- }
232
-
233
-
234
- public void setMapPadding(@Nullable ReadableMap padding) {
235
- if (getMapView() != null) {
236
- int left = 0;
237
- int top = 0;
238
- int right = 0;
239
- int bottom = 0;
240
- double density = (double) getMapView().getResources().getDisplayMetrics().density;
241
-
242
- if (padding != null) {
243
- if (padding.hasKey("left")) {
244
- left = (int) (padding.getDouble("left") * density);
245
- }
246
-
247
- if (padding.hasKey("top")) {
248
- top = (int) (padding.getDouble("top") * density);
249
- }
250
-
251
- if (padding.hasKey("right")) {
252
- right = (int) (padding.getDouble("right") * density);
253
- }
254
-
255
- if (padding.hasKey("bottom")) {
256
- bottom = (int) (padding.getDouble("bottom") * density);
257
- }
258
- }
259
-
260
- getMapView().applyBaseMapPadding(left, top, right, bottom);
261
- getMapView().map.setPadding(left, top, right, bottom);
262
- }
263
- this.mapPadding = padding;
264
- }
265
-
266
- public void setMoveOnMarkerPress(boolean value) {
267
- if (getMapView() != null){
268
- getMapView().setMoveOnMarkerPress(value);
269
- }
270
- moveOnMarkerPress = value;
271
- }
272
-
273
-
274
- public void setHandlePanDrag(boolean value) {
275
- if (getMapView() != null) {
276
- getMapView().setHandlePanDrag(value);
277
- }
278
- handlePanDrag = value;
279
- }
280
-
281
- public void setRegion(@Nullable ReadableMap value) {
282
- if (getMapView() != null) {
283
- getMapView().setRegion(value);
284
- }
285
- region = value;
286
- }
287
-
288
-
289
- public void setShowsBuildings(boolean value) {
290
- showsBuildings = value;
291
- if (getMapView() != null){
292
- getMapView().setShowBuildings(value);
293
- }
294
- }
295
-
296
-
297
- public void setShowsCompass(boolean value) {
298
- if (getMapView() != null) {
299
- getMapView().setShowsCompass(value);
300
- }
301
- }
302
-
303
-
304
- public void setShowsIndoorLevelPicker(boolean value) {
305
- if (getMapView() != null) {
306
- getMapView().setShowsIndoorLevelPicker(value);
307
- }
308
- showsIndoorLevelPicker = value;
309
- }
310
-
311
-
312
- public void setShowsIndoors(boolean value) {
313
- if (getMapView() != null){
314
- getMapView().setShowIndoors(value);
315
- }
316
-
317
- showIndoors = value;
318
- }
319
-
320
-
321
- public void setShowsMyLocationButton(boolean value) {
322
- if (getMapView() != null) {
323
- getMapView().setShowsMyLocationButton(value);
324
- }
325
- showsMyLocationButton = value;
326
- }
327
-
328
- public void setShowsUserLocation(boolean value) {
329
- if (getMapView() != null) {
330
- getMapView().setShowsUserLocation(value);
331
- }
332
- showsUserLocation = value;
333
- }
334
-
335
- public void setUserLocationFastestInterval(int value) {
336
- if (getMapView() != null) {
337
- getMapView().setUserLocationFastestInterval(value);
338
- }
339
- userLocationFastestInterval = value;
340
- }
341
-
342
-
343
- public void setUserLocationPriority(@Nullable String value) {
344
- if (mapView != null) {
345
- mapView.setUserLocationPriority(MY_LOCATION_PRIORITY.get(value));
346
- } else {
347
- userLocationPriority = MY_LOCATION_PRIORITY.get(value);
348
- }
349
- }
350
-
351
-
352
- public void setUserLocationUpdateInterval(int value) {
353
- if (getMapView() != null) {
354
- getMapView().setUserLocationUpdateInterval(value);
355
- }
356
- userLocationUpdateInterval = value;
357
- }
358
-
359
-
360
- public void setZoomControlEnabled(boolean value) {
361
- getMapView().setZoomControlEnabled(value);
362
- }
363
-
364
-
365
- public void setZoomEnabled(boolean value) {
366
- getMapView().setZoomEnabled(value);
367
- }
368
-
369
- }