react-native-maps 1.4.0 → 1.5.0
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.
- package/README.md +63 -87
- package/android/build.gradle +3 -4
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/FileUtil.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/FusedLocationSource.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReadable.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReader.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageUtil.java +1 -2
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/LatLngBoundsUtils.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCallout.java → rnmaps/maps/MapCallout.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCalloutManager.java → rnmaps/maps/MapCalloutManager.java} +6 -6
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircle.java → rnmaps/maps/MapCircle.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircleManager.java → rnmaps/maps/MapCircleManager.java} +11 -11
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapFeature.java → rnmaps/maps/MapFeature.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolyline.java → rnmaps/maps/MapGradientPolyline.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolylineManager.java → rnmaps/maps/MapGradientPolylineManager.java} +9 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmap.java → rnmaps/maps/MapHeatmap.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmapManager.java → rnmaps/maps/MapHeatmapManager.java} +8 -8
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLiteManager.java → rnmaps/maps/MapLiteManager.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLocalTile.java → rnmaps/maps/MapLocalTile.java} +5 -5
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLocalTileManager.java → rnmaps/maps/MapLocalTileManager.java} +9 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapManager.java → rnmaps/maps/MapManager.java} +48 -48
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapMarker.java → rnmaps/maps/MapMarker.java} +12 -12
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapMarkerManager.java → rnmaps/maps/MapMarkerManager.java} +30 -30
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapModule.java → rnmaps/maps/MapModule.java} +10 -10
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapOverlay.java → rnmaps/maps/MapOverlay.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapOverlayManager.java → rnmaps/maps/MapOverlayManager.java} +11 -11
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygon.java → rnmaps/maps/MapPolygon.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygonManager.java → rnmaps/maps/MapPolygonManager.java} +13 -13
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolyline.java → rnmaps/maps/MapPolyline.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolylineManager.java → rnmaps/maps/MapPolylineManager.java} +13 -13
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileProvider.java → rnmaps/maps/MapTileProvider.java} +10 -10
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileWorker.java → rnmaps/maps/MapTileWorker.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapUrlTile.java → rnmaps/maps/MapUrlTile.java} +5 -5
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapUrlTileManager.java → rnmaps/maps/MapUrlTileManager.java} +17 -17
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapView.java → rnmaps/maps/MapView.java} +62 -63
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapWMSTile.java → rnmaps/maps/MapWMSTile.java} +6 -6
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapWMSTileManager.java → rnmaps/maps/MapWMSTileManager.java} +15 -15
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +46 -0
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/RegionChangeEvent.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/SizeReportingShadowNode.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewAttacherGroup.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewChangesTracker.java +7 -7
- package/package.json +15 -13
- package/android/src/main/java/com/airbnb/android/react/maps/MapsPackage.java +0 -65
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.graphics.Bitmap;
|
|
4
4
|
import android.graphics.Color;
|
|
@@ -23,12 +23,12 @@ import java.util.Map;
|
|
|
23
23
|
import java.util.WeakHashMap;
|
|
24
24
|
import java.util.concurrent.ConcurrentHashMap;
|
|
25
25
|
|
|
26
|
-
public class
|
|
26
|
+
public class MapMarkerManager extends ViewGroupManager<MapMarker> {
|
|
27
27
|
|
|
28
28
|
public static class AirMapMarkerSharedIcon {
|
|
29
29
|
private BitmapDescriptor iconBitmapDescriptor;
|
|
30
30
|
private Bitmap bitmap;
|
|
31
|
-
private final Map<
|
|
31
|
+
private final Map<MapMarker, Boolean> markers;
|
|
32
32
|
private boolean loadImageStarted;
|
|
33
33
|
|
|
34
34
|
public AirMapMarkerSharedIcon(){
|
|
@@ -57,7 +57,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
57
57
|
*
|
|
58
58
|
* @param marker
|
|
59
59
|
*/
|
|
60
|
-
public synchronized void addMarker(
|
|
60
|
+
public synchronized void addMarker(MapMarker marker) {
|
|
61
61
|
this.markers.put(marker, true);
|
|
62
62
|
if (this.iconBitmapDescriptor != null) {
|
|
63
63
|
marker.setIconBitmapDescriptor(this.iconBitmapDescriptor, this.bitmap);
|
|
@@ -71,7 +71,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
71
71
|
*
|
|
72
72
|
* @param marker
|
|
73
73
|
*/
|
|
74
|
-
public synchronized void removeMarker(
|
|
74
|
+
public synchronized void removeMarker(MapMarker marker) {
|
|
75
75
|
this.markers.remove(marker);
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -101,7 +101,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
for (Map.Entry<
|
|
104
|
+
for (Map.Entry<MapMarker, Boolean> markerEntry: markers.entrySet()) {
|
|
105
105
|
if (markerEntry.getKey() != null) {
|
|
106
106
|
markerEntry.getKey().setIconBitmapDescriptor(bitmapDescriptor, bitmap);
|
|
107
107
|
}
|
|
@@ -147,7 +147,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
public
|
|
150
|
+
public MapMarkerManager() {
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
@Override
|
|
@@ -156,27 +156,27 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
@Override
|
|
159
|
-
public
|
|
160
|
-
return new
|
|
159
|
+
public MapMarker createViewInstance(ThemedReactContext context) {
|
|
160
|
+
return new MapMarker(context, this);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
@ReactProp(name = "coordinate")
|
|
164
|
-
public void setCoordinate(
|
|
164
|
+
public void setCoordinate(MapMarker view, ReadableMap map) {
|
|
165
165
|
view.setCoordinate(map);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
@ReactProp(name = "title")
|
|
169
|
-
public void setTitle(
|
|
169
|
+
public void setTitle(MapMarker view, String title) {
|
|
170
170
|
view.setTitle(title);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
@ReactProp(name = "identifier")
|
|
174
|
-
public void setIdentifier(
|
|
174
|
+
public void setIdentifier(MapMarker view, String identifier) {
|
|
175
175
|
view.setIdentifier(identifier);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
@ReactProp(name = "description")
|
|
179
|
-
public void setDescription(
|
|
179
|
+
public void setDescription(MapMarker view, String description) {
|
|
180
180
|
view.setSnippet(description);
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -195,7 +195,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
195
195
|
// }
|
|
196
196
|
|
|
197
197
|
@ReactProp(name = "anchor")
|
|
198
|
-
public void setAnchor(
|
|
198
|
+
public void setAnchor(MapMarker view, ReadableMap map) {
|
|
199
199
|
// should default to (0.5, 1) (bottom middle)
|
|
200
200
|
double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
|
|
201
201
|
double y = map != null && map.hasKey("y") ? map.getDouble("y") : 1.0;
|
|
@@ -203,7 +203,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
@ReactProp(name = "calloutAnchor")
|
|
206
|
-
public void setCalloutAnchor(
|
|
206
|
+
public void setCalloutAnchor(MapMarker view, ReadableMap map) {
|
|
207
207
|
// should default to (0.5, 0) (top middle)
|
|
208
208
|
double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
|
|
209
209
|
double y = map != null && map.hasKey("y") ? map.getDouble("y") : 0.0;
|
|
@@ -211,7 +211,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@ReactProp(name = "image")
|
|
214
|
-
public void setImage(
|
|
214
|
+
public void setImage(MapMarker view, @Nullable String source) {
|
|
215
215
|
view.setImage(source);
|
|
216
216
|
}
|
|
217
217
|
// public void setImage(AirMapMarker view, ReadableMap image) {
|
|
@@ -219,12 +219,12 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
219
219
|
// }
|
|
220
220
|
|
|
221
221
|
@ReactProp(name = "icon")
|
|
222
|
-
public void setIcon(
|
|
222
|
+
public void setIcon(MapMarker view, @Nullable String source) {
|
|
223
223
|
view.setImage(source);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
@ReactProp(name = "pinColor", defaultInt = Color.RED, customType = "Color")
|
|
227
|
-
public void setPinColor(
|
|
227
|
+
public void setPinColor(MapMarker view, int pinColor) {
|
|
228
228
|
float[] hsv = new float[3];
|
|
229
229
|
Color.colorToHSV(pinColor, hsv);
|
|
230
230
|
// NOTE: android only supports a hue
|
|
@@ -232,23 +232,23 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
@ReactProp(name = "rotation", defaultFloat = 0.0f)
|
|
235
|
-
public void setMarkerRotation(
|
|
235
|
+
public void setMarkerRotation(MapMarker view, float rotation) {
|
|
236
236
|
view.setRotation(rotation);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
@ReactProp(name = "flat", defaultBoolean = false)
|
|
240
|
-
public void setFlat(
|
|
240
|
+
public void setFlat(MapMarker view, boolean flat) {
|
|
241
241
|
view.setFlat(flat);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
@ReactProp(name = "draggable", defaultBoolean = false)
|
|
245
|
-
public void setDraggable(
|
|
245
|
+
public void setDraggable(MapMarker view, boolean draggable) {
|
|
246
246
|
view.setDraggable(draggable);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
@Override
|
|
250
250
|
@ReactProp(name = "zIndex", defaultFloat = 0.0f)
|
|
251
|
-
public void setZIndex(
|
|
251
|
+
public void setZIndex(MapMarker view, float zIndex) {
|
|
252
252
|
super.setZIndex(view, zIndex);
|
|
253
253
|
int integerZIndex = Math.round(zIndex);
|
|
254
254
|
view.setZIndex(integerZIndex);
|
|
@@ -256,22 +256,22 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
256
256
|
|
|
257
257
|
@Override
|
|
258
258
|
@ReactProp(name = "opacity", defaultFloat = 1.0f)
|
|
259
|
-
public void setOpacity(
|
|
259
|
+
public void setOpacity(MapMarker view, float opacity) {
|
|
260
260
|
super.setOpacity(view, opacity);
|
|
261
261
|
view.setOpacity(opacity);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
@ReactProp(name = "tracksViewChanges", defaultBoolean = true)
|
|
265
|
-
public void setTracksViewChanges(
|
|
265
|
+
public void setTracksViewChanges(MapMarker view, boolean tracksViewChanges) {
|
|
266
266
|
view.setTracksViewChanges(tracksViewChanges);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
@Override
|
|
270
|
-
public void addView(
|
|
270
|
+
public void addView(MapMarker parent, View child, int index) {
|
|
271
271
|
// if an <Callout /> component is a child, then it is a callout view, NOT part of the
|
|
272
272
|
// marker.
|
|
273
|
-
if (child instanceof
|
|
274
|
-
parent.setCalloutView((
|
|
273
|
+
if (child instanceof MapCallout) {
|
|
274
|
+
parent.setCalloutView((MapCallout) child);
|
|
275
275
|
} else {
|
|
276
276
|
super.addView(parent, child, index);
|
|
277
277
|
parent.update(true);
|
|
@@ -279,13 +279,13 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
@Override
|
|
282
|
-
public void removeViewAt(
|
|
282
|
+
public void removeViewAt(MapMarker parent, int index) {
|
|
283
283
|
super.removeViewAt(parent, index);
|
|
284
284
|
parent.update(true);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
@Override
|
|
288
|
-
public void receiveCommand(@NonNull
|
|
288
|
+
public void receiveCommand(@NonNull MapMarker view, String commandId, @Nullable ReadableArray args) {
|
|
289
289
|
int duration;
|
|
290
290
|
double lat;
|
|
291
291
|
double lng;
|
|
@@ -347,7 +347,7 @@ public class AirMapMarkerManager extends ViewGroupManager<AirMapMarker> {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
@Override
|
|
350
|
-
public void updateExtraData(
|
|
350
|
+
public void updateExtraData(MapMarker view, Object extraData) {
|
|
351
351
|
// This method is called from the shadow node with the width/height of the rendered
|
|
352
352
|
// marker view.
|
|
353
353
|
HashMap<String, Float> data = (HashMap<String, Float>) extraData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.graphics.Bitmap;
|
|
@@ -40,8 +40,8 @@ import java.util.List;
|
|
|
40
40
|
import java.util.Map;
|
|
41
41
|
import java.util.HashMap;
|
|
42
42
|
|
|
43
|
-
@ReactModule(name =
|
|
44
|
-
public class
|
|
43
|
+
@ReactModule(name = MapModule.NAME)
|
|
44
|
+
public class MapModule extends ReactContextBaseJavaModule {
|
|
45
45
|
|
|
46
46
|
public static final String NAME = "AirMapModule";
|
|
47
47
|
private static final String SNAPSHOT_RESULT_FILE = "file";
|
|
@@ -49,7 +49,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
49
49
|
private static final String SNAPSHOT_FORMAT_PNG = "png";
|
|
50
50
|
private static final String SNAPSHOT_FORMAT_JPG = "jpg";
|
|
51
51
|
|
|
52
|
-
public
|
|
52
|
+
public MapModule(ReactApplicationContext reactContext) {
|
|
53
53
|
super(reactContext);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -98,7 +98,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
98
98
|
UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
|
|
99
99
|
uiManager.addUIBlock(new UIBlock() {
|
|
100
100
|
public void execute(NativeViewHierarchyManager nvhm) {
|
|
101
|
-
|
|
101
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
102
102
|
if (view == null) {
|
|
103
103
|
promise.reject("AirMapView not found");
|
|
104
104
|
return;
|
|
@@ -160,7 +160,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
160
160
|
@Override
|
|
161
161
|
public void execute(NativeViewHierarchyManager nvhm)
|
|
162
162
|
{
|
|
163
|
-
|
|
163
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
164
164
|
if (view == null) {
|
|
165
165
|
promise.reject("AirMapView not found");
|
|
166
166
|
return;
|
|
@@ -197,7 +197,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
197
197
|
@Override
|
|
198
198
|
public void execute(NativeViewHierarchyManager nvhm)
|
|
199
199
|
{
|
|
200
|
-
|
|
200
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
201
201
|
if (view == null) {
|
|
202
202
|
promise.reject("AirMapView not found");
|
|
203
203
|
return;
|
|
@@ -258,7 +258,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
258
258
|
@Override
|
|
259
259
|
public void execute(NativeViewHierarchyManager nvhm)
|
|
260
260
|
{
|
|
261
|
-
|
|
261
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
262
262
|
if (view == null) {
|
|
263
263
|
promise.reject("AirMapView not found");
|
|
264
264
|
return;
|
|
@@ -295,7 +295,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
295
295
|
@Override
|
|
296
296
|
public void execute(NativeViewHierarchyManager nvhm)
|
|
297
297
|
{
|
|
298
|
-
|
|
298
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
299
299
|
if (view == null)
|
|
300
300
|
{
|
|
301
301
|
promise.reject("AirMapView not found");
|
|
@@ -328,7 +328,7 @@ public class AirMapModule extends ReactContextBaseJavaModule {
|
|
|
328
328
|
@Override
|
|
329
329
|
public void execute(NativeViewHierarchyManager nvhm)
|
|
330
330
|
{
|
|
331
|
-
|
|
331
|
+
MapView view = (MapView) nvhm.resolveView(tag);
|
|
332
332
|
if (view == null) {
|
|
333
333
|
promise.reject("AirMapView not found");
|
|
334
334
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Bitmap;
|
|
@@ -12,7 +12,7 @@ import com.google.android.gms.maps.model.GroundOverlayOptions;
|
|
|
12
12
|
import com.google.android.gms.maps.model.LatLng;
|
|
13
13
|
import com.google.android.gms.maps.model.LatLngBounds;
|
|
14
14
|
|
|
15
|
-
public class
|
|
15
|
+
public class MapOverlay extends MapFeature implements ImageReadable {
|
|
16
16
|
|
|
17
17
|
private GroundOverlayOptions groundOverlayOptions;
|
|
18
18
|
private GroundOverlay groundOverlay;
|
|
@@ -26,7 +26,7 @@ public class AirMapOverlay extends AirMapFeature implements ImageReadable {
|
|
|
26
26
|
private final ImageReader mImageReader;
|
|
27
27
|
private GoogleMap map;
|
|
28
28
|
|
|
29
|
-
public
|
|
29
|
+
public MapOverlay(Context context) {
|
|
30
30
|
super(context);
|
|
31
31
|
this.mImageReader = new ImageReader(context, getResources(), this);
|
|
32
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.util.DisplayMetrics;
|
|
@@ -15,9 +15,9 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
|
|
15
15
|
|
|
16
16
|
import java.util.Map;
|
|
17
17
|
|
|
18
|
-
public class
|
|
18
|
+
public class MapOverlayManager extends ViewGroupManager<MapOverlay> {
|
|
19
19
|
|
|
20
|
-
public
|
|
20
|
+
public MapOverlayManager(ReactApplicationContext reactContext) {
|
|
21
21
|
super();
|
|
22
22
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
23
23
|
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
|
|
@@ -31,37 +31,37 @@ public class AirMapOverlayManager extends ViewGroupManager<AirMapOverlay> {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
@Override
|
|
34
|
-
public
|
|
35
|
-
return new
|
|
34
|
+
public MapOverlay createViewInstance(ThemedReactContext context) {
|
|
35
|
+
return new MapOverlay(context);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
@ReactProp(name = "bounds")
|
|
39
|
-
public void setBounds(
|
|
39
|
+
public void setBounds(MapOverlay view, ReadableArray bounds) {
|
|
40
40
|
view.setBounds(bounds);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@ReactProp(name = "bearing")
|
|
44
|
-
public void setBearing(
|
|
44
|
+
public void setBearing(MapOverlay view, float bearing){
|
|
45
45
|
view.setBearing(bearing);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
@ReactProp(name = "zIndex", defaultFloat = 1.0f)
|
|
49
|
-
public void setZIndex(
|
|
49
|
+
public void setZIndex(MapOverlay view, float zIndex) {
|
|
50
50
|
view.setZIndex(zIndex);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
@ReactProp(name = "opacity", defaultFloat = 1.0f)
|
|
54
|
-
public void setOpacity(
|
|
54
|
+
public void setOpacity(MapOverlay view, float opacity) {
|
|
55
55
|
view.setTransparency(1 - opacity);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
@ReactProp(name = "image")
|
|
59
|
-
public void setImage(
|
|
59
|
+
public void setImage(MapOverlay view, @Nullable String source) {
|
|
60
60
|
view.setImage(source);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
@ReactProp(name = "tappable", defaultBoolean = false)
|
|
64
|
-
public void setTappable(
|
|
64
|
+
public void setTappable(MapOverlay view, boolean tapabble) {
|
|
65
65
|
view.setTappable(tapabble);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ import com.google.android.gms.maps.model.PolygonOptions;
|
|
|
12
12
|
import java.util.ArrayList;
|
|
13
13
|
import java.util.List;
|
|
14
14
|
|
|
15
|
-
public class
|
|
15
|
+
public class MapPolygon extends MapFeature {
|
|
16
16
|
|
|
17
17
|
private PolygonOptions polygonOptions;
|
|
18
18
|
private Polygon polygon;
|
|
@@ -26,7 +26,7 @@ public class AirMapPolygon extends AirMapFeature {
|
|
|
26
26
|
private boolean tappable;
|
|
27
27
|
private float zIndex;
|
|
28
28
|
|
|
29
|
-
public
|
|
29
|
+
public MapPolygon(Context context) {
|
|
30
30
|
super(context);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Color;
|
|
@@ -16,10 +16,10 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
|
|
16
16
|
|
|
17
17
|
import java.util.Map;
|
|
18
18
|
|
|
19
|
-
public class
|
|
19
|
+
public class MapPolygonManager extends ViewGroupManager<MapPolygon> {
|
|
20
20
|
private final DisplayMetrics metrics;
|
|
21
21
|
|
|
22
|
-
public
|
|
22
|
+
public MapPolygonManager(ReactApplicationContext reactContext) {
|
|
23
23
|
super();
|
|
24
24
|
metrics = new DisplayMetrics();
|
|
25
25
|
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
|
|
@@ -33,48 +33,48 @@ public class AirMapPolygonManager extends ViewGroupManager<AirMapPolygon> {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@Override
|
|
36
|
-
public
|
|
37
|
-
return new
|
|
36
|
+
public MapPolygon createViewInstance(ThemedReactContext context) {
|
|
37
|
+
return new MapPolygon(context);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@ReactProp(name = "coordinates")
|
|
41
|
-
public void setCoordinate(
|
|
41
|
+
public void setCoordinate(MapPolygon view, ReadableArray coordinates) {
|
|
42
42
|
view.setCoordinates(coordinates);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
@ReactProp(name = "holes")
|
|
46
|
-
public void setHoles(
|
|
46
|
+
public void setHoles(MapPolygon view, ReadableArray holes) {
|
|
47
47
|
view.setHoles(holes);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
@ReactProp(name = "strokeWidth", defaultFloat = 1f)
|
|
51
|
-
public void setStrokeWidth(
|
|
51
|
+
public void setStrokeWidth(MapPolygon view, float widthInPoints) {
|
|
52
52
|
float widthInScreenPx = metrics.density * widthInPoints; // done for parity with iOS
|
|
53
53
|
view.setStrokeWidth(widthInScreenPx);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@ReactProp(name = "fillColor", defaultInt = Color.RED, customType = "Color")
|
|
57
|
-
public void setFillColor(
|
|
57
|
+
public void setFillColor(MapPolygon view, int color) {
|
|
58
58
|
view.setFillColor(color);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
@ReactProp(name = "strokeColor", defaultInt = Color.RED, customType = "Color")
|
|
62
|
-
public void setStrokeColor(
|
|
62
|
+
public void setStrokeColor(MapPolygon view, int color) {
|
|
63
63
|
view.setStrokeColor(color);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
@ReactProp(name = "tappable", defaultBoolean = false)
|
|
67
|
-
public void setTappable(
|
|
67
|
+
public void setTappable(MapPolygon view, boolean tapabble) {
|
|
68
68
|
view.setTappable(tapabble);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
@ReactProp(name = "geodesic", defaultBoolean = false)
|
|
72
|
-
public void setGeodesic(
|
|
72
|
+
public void setGeodesic(MapPolygon view, boolean geodesic) {
|
|
73
73
|
view.setGeodesic(geodesic);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
@ReactProp(name = "zIndex", defaultFloat = 1.0f)
|
|
77
|
-
public void setZIndex(
|
|
77
|
+
public void setZIndex(MapPolygon view, float zIndex) {
|
|
78
78
|
view.setZIndex(zIndex);
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ import com.google.android.gms.maps.model.RoundCap;
|
|
|
18
18
|
import java.util.ArrayList;
|
|
19
19
|
import java.util.List;
|
|
20
20
|
|
|
21
|
-
public class
|
|
21
|
+
public class MapPolyline extends MapFeature {
|
|
22
22
|
|
|
23
23
|
private PolylineOptions polylineOptions;
|
|
24
24
|
private Polyline polyline;
|
|
@@ -33,7 +33,7 @@ public class AirMapPolyline extends AirMapFeature {
|
|
|
33
33
|
private ReadableArray patternValues;
|
|
34
34
|
private List<PatternItem> pattern;
|
|
35
35
|
|
|
36
|
-
public
|
|
36
|
+
public MapPolyline(Context context) {
|
|
37
37
|
super(context);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Color;
|
|
@@ -20,10 +20,10 @@ import com.google.android.gms.maps.model.SquareCap;
|
|
|
20
20
|
|
|
21
21
|
import java.util.Map;
|
|
22
22
|
|
|
23
|
-
public class
|
|
23
|
+
public class MapPolylineManager extends ViewGroupManager<MapPolyline> {
|
|
24
24
|
private final DisplayMetrics metrics;
|
|
25
25
|
|
|
26
|
-
public
|
|
26
|
+
public MapPolylineManager(ReactApplicationContext reactContext) {
|
|
27
27
|
super();
|
|
28
28
|
metrics = new DisplayMetrics();
|
|
29
29
|
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
|
|
@@ -37,43 +37,43 @@ public class AirMapPolylineManager extends ViewGroupManager<AirMapPolyline> {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@Override
|
|
40
|
-
public
|
|
41
|
-
return new
|
|
40
|
+
public MapPolyline createViewInstance(ThemedReactContext context) {
|
|
41
|
+
return new MapPolyline(context);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
@ReactProp(name = "coordinates")
|
|
45
|
-
public void setCoordinate(
|
|
45
|
+
public void setCoordinate(MapPolyline view, ReadableArray coordinates) {
|
|
46
46
|
view.setCoordinates(coordinates);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
@ReactProp(name = "strokeWidth", defaultFloat = 1f)
|
|
50
|
-
public void setStrokeWidth(
|
|
50
|
+
public void setStrokeWidth(MapPolyline view, float widthInPoints) {
|
|
51
51
|
float widthInScreenPx = metrics.density * widthInPoints; // done for parity with iOS
|
|
52
52
|
view.setWidth(widthInScreenPx);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
@ReactProp(name = "strokeColor", defaultInt = Color.RED, customType = "Color")
|
|
56
|
-
public void setStrokeColor(
|
|
56
|
+
public void setStrokeColor(MapPolyline view, int color) {
|
|
57
57
|
view.setColor(color);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
@ReactProp(name = "tappable", defaultBoolean = false)
|
|
61
|
-
public void setTappable(
|
|
61
|
+
public void setTappable(MapPolyline view, boolean tapabble) {
|
|
62
62
|
view.setTappable(tapabble);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
@ReactProp(name = "geodesic", defaultBoolean = false)
|
|
66
|
-
public void setGeodesic(
|
|
66
|
+
public void setGeodesic(MapPolyline view, boolean geodesic) {
|
|
67
67
|
view.setGeodesic(geodesic);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
@ReactProp(name = "zIndex", defaultFloat = 1.0f)
|
|
71
|
-
public void setZIndex(
|
|
71
|
+
public void setZIndex(MapPolyline view, float zIndex) {
|
|
72
72
|
view.setZIndex(zIndex);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
@ReactProp(name = "lineCap")
|
|
76
|
-
public void setlineCap(
|
|
76
|
+
public void setlineCap(MapPolyline view, String lineCap) {
|
|
77
77
|
Cap cap = null;
|
|
78
78
|
switch (lineCap) {
|
|
79
79
|
case "butt":
|
|
@@ -93,7 +93,7 @@ public class AirMapPolylineManager extends ViewGroupManager<AirMapPolyline> {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
@ReactProp(name = "lineDashPattern")
|
|
96
|
-
public void setLineDashPattern(
|
|
96
|
+
public void setLineDashPattern(MapPolyline view, ReadableArray patternValues) {
|
|
97
97
|
view.setLineDashPattern(patternValues);
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
@@ -41,7 +41,7 @@ import java.net.MalformedURLException;
|
|
|
41
41
|
import java.net.URL;
|
|
42
42
|
import java.net.URLConnection;
|
|
43
43
|
|
|
44
|
-
public class
|
|
44
|
+
public class MapTileProvider implements TileProvider {
|
|
45
45
|
|
|
46
46
|
class AIRMapUrlTileProvider extends UrlTileProvider {
|
|
47
47
|
private String urlTemplate;
|
|
@@ -54,7 +54,7 @@ public class AirMapTileProvider implements TileProvider {
|
|
|
54
54
|
@Override
|
|
55
55
|
public URL getTileUrl(int x, int y, int zoom) {
|
|
56
56
|
|
|
57
|
-
if (
|
|
57
|
+
if (MapTileProvider.this.flipY) {
|
|
58
58
|
y = (1 << zoom) - y - 1;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -64,11 +64,11 @@ public class AirMapTileProvider implements TileProvider {
|
|
|
64
64
|
.replace("{z}", Integer.toString(zoom));
|
|
65
65
|
URL url;
|
|
66
66
|
|
|
67
|
-
if(
|
|
67
|
+
if(MapTileProvider.this.maximumZ > 0 && zoom > MapTileProvider.this.maximumZ) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
if(
|
|
71
|
+
if(MapTileProvider.this.minimumZ > 0 && zoom < MapTileProvider.this.minimumZ) {
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -101,9 +101,9 @@ public class AirMapTileProvider implements TileProvider {
|
|
|
101
101
|
protected Context context;
|
|
102
102
|
protected boolean customMode;
|
|
103
103
|
|
|
104
|
-
public
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
public MapTileProvider(int tileSizet, boolean doubleTileSize, String urlTemplate,
|
|
105
|
+
int maximumZ, int maximumNativeZ, int minimumZ, boolean flipY, String tileCachePath,
|
|
106
|
+
int tileCacheMaxAge, boolean offlineMode, Context context, boolean customMode) {
|
|
107
107
|
this.tileProvider = new AIRMapUrlTileProvider(tileSizet, tileSizet, urlTemplate);
|
|
108
108
|
|
|
109
109
|
this.tileSize = tileSizet;
|
|
@@ -179,7 +179,7 @@ public class AirMapTileProvider implements TileProvider {
|
|
|
179
179
|
Constraints constraints = new Constraints.Builder()
|
|
180
180
|
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
181
181
|
.build();
|
|
182
|
-
OneTimeWorkRequest tileRefreshWorkRequest = new OneTimeWorkRequest.Builder(
|
|
182
|
+
OneTimeWorkRequest tileRefreshWorkRequest = new OneTimeWorkRequest.Builder(MapTileWorker.class)
|
|
183
183
|
.setConstraints(constraints)
|
|
184
184
|
.addTag(fileName)
|
|
185
185
|
.setInputData(
|
|
@@ -328,7 +328,7 @@ public class AirMapTileProvider implements TileProvider {
|
|
|
328
328
|
Constraints constraints = new Constraints.Builder()
|
|
329
329
|
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
330
330
|
.build();
|
|
331
|
-
OneTimeWorkRequest tileRefreshWorkRequest = new OneTimeWorkRequest.Builder(
|
|
331
|
+
OneTimeWorkRequest tileRefreshWorkRequest = new OneTimeWorkRequest.Builder(MapTileWorker.class)
|
|
332
332
|
.setConstraints(constraints)
|
|
333
333
|
.addTag(fileName)
|
|
334
334
|
.setInputData(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
@@ -18,10 +18,10 @@ import java.io.IOException;
|
|
|
18
18
|
import java.net.MalformedURLException;
|
|
19
19
|
import java.net.URL;
|
|
20
20
|
|
|
21
|
-
public class
|
|
21
|
+
public class MapTileWorker extends Worker {
|
|
22
22
|
private static final int BUFFER_SIZE = 16 * 1024;
|
|
23
23
|
|
|
24
|
-
public
|
|
24
|
+
public MapTileWorker(
|
|
25
25
|
@NonNull Context context,
|
|
26
26
|
@NonNull WorkerParameters params) {
|
|
27
27
|
super(context, params);
|