react-native-maps 1.21.0-alpha.83 → 1.21.0-alpha.84
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.
|
@@ -322,10 +322,6 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
322
322
|
((MapMarker) child).setImageLoadedListener((uri, drawable, b) -> {
|
|
323
323
|
parent.addFeature(child, parent.getFeatureCount());
|
|
324
324
|
});
|
|
325
|
-
// } else if (child instanceof MapOverlay && ((MapOverlay) child).isLoadingImage()){
|
|
326
|
-
// ((MapOverlay) child).setImageLoadedListener((uri, drawable, b) -> {
|
|
327
|
-
// parent.addFeature(child, parent.getFeatureCount());
|
|
328
|
-
// });
|
|
329
325
|
} else {
|
|
330
326
|
parent.addFeature(child, index);
|
|
331
327
|
}
|
|
@@ -84,7 +84,8 @@ public class OverlayManager extends ViewGroupManager<MapOverlay> implements RNMa
|
|
|
84
84
|
|
|
85
85
|
@Override
|
|
86
86
|
public void setOpacity(MapOverlay view, float value) {
|
|
87
|
-
|
|
87
|
+
// todo report to google that it's not working / fix it
|
|
88
|
+
// view.setTransparency(value);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
@Override
|
|
@@ -2,25 +2,29 @@ package com.rnmaps.maps;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Bitmap;
|
|
5
|
-
import android.graphics.BitmapFactory;
|
|
6
5
|
import android.graphics.Canvas;
|
|
6
|
+
import android.graphics.Color;
|
|
7
|
+
import android.graphics.Paint;
|
|
7
8
|
import android.graphics.drawable.Animatable;
|
|
8
|
-
import android.graphics.drawable.Drawable;
|
|
9
9
|
import android.net.Uri;
|
|
10
|
+
import android.os.Handler;
|
|
11
|
+
import android.os.Looper;
|
|
10
12
|
|
|
11
13
|
import androidx.annotation.Nullable;
|
|
12
14
|
|
|
13
15
|
import com.facebook.common.references.CloseableReference;
|
|
16
|
+
import com.facebook.datasource.BaseDataSubscriber;
|
|
14
17
|
import com.facebook.datasource.DataSource;
|
|
18
|
+
import com.facebook.datasource.DataSubscriber;
|
|
15
19
|
import com.facebook.drawee.backends.pipeline.Fresco;
|
|
16
20
|
import com.facebook.drawee.controller.BaseControllerListener;
|
|
17
21
|
import com.facebook.drawee.controller.ControllerListener;
|
|
18
22
|
import com.facebook.drawee.drawable.ScalingUtils;
|
|
19
23
|
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
|
20
24
|
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
|
|
21
|
-
import com.facebook.drawee.interfaces.DraweeController;
|
|
22
25
|
import com.facebook.drawee.view.DraweeHolder;
|
|
23
26
|
import com.facebook.imagepipeline.core.ImagePipeline;
|
|
27
|
+
import com.facebook.imagepipeline.image.CloseableBitmap;
|
|
24
28
|
import com.facebook.imagepipeline.image.CloseableImage;
|
|
25
29
|
import com.facebook.imagepipeline.image.CloseableStaticBitmap;
|
|
26
30
|
import com.facebook.imagepipeline.image.ImageInfo;
|
|
@@ -39,300 +43,262 @@ import com.google.maps.android.collections.GroundOverlayManager;
|
|
|
39
43
|
import com.rnmaps.fabric.event.OnPressEvent;
|
|
40
44
|
|
|
41
45
|
import java.util.Map;
|
|
46
|
+
import java.util.concurrent.Executors;
|
|
42
47
|
|
|
43
48
|
public class MapOverlay extends MapFeature implements ImageReadable {
|
|
44
49
|
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
logoHolder.onAttach();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private GenericDraweeHierarchy createDraweeHierarchy() {
|
|
88
|
-
return new GenericDraweeHierarchyBuilder(getResources())
|
|
89
|
-
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
|
|
90
|
-
.setFadeDuration(0)
|
|
91
|
-
.build();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private final ControllerListener<ImageInfo> mLogoControllerListener =
|
|
95
|
-
new BaseControllerListener<ImageInfo>() {
|
|
96
|
-
@Override
|
|
97
|
-
public void onSubmit(String id, Object callerContext){
|
|
98
|
-
loadingImage = true;
|
|
99
|
-
}
|
|
100
|
-
@Override
|
|
101
|
-
public void onFinalImageSet(
|
|
102
|
-
String id,
|
|
103
|
-
@Nullable final ImageInfo imageInfo,
|
|
104
|
-
@Nullable Animatable animatable) {
|
|
105
|
-
CloseableReference<CloseableImage> imageReference = null;
|
|
106
|
-
try {
|
|
107
|
-
imageReference = dataSource.getResult();
|
|
108
|
-
if (imageReference != null) {
|
|
109
|
-
CloseableImage image = imageReference.get();
|
|
110
|
-
if (image instanceof CloseableStaticBitmap) {
|
|
111
|
-
CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
|
|
112
|
-
Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
|
|
113
|
-
if (bitmap != null) {
|
|
114
|
-
bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
|
|
115
|
-
iconBitmap = bitmap;
|
|
116
|
-
iconBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} finally {
|
|
121
|
-
dataSource.close();
|
|
122
|
-
if (imageReference != null) {
|
|
123
|
-
CloseableReference.closeSafely(imageReference);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
loadingImage = false;
|
|
128
|
-
if (imageLoadedListener != null){
|
|
129
|
-
imageLoadedListener.onImageLoaded(null, null, false);
|
|
130
|
-
// fire and forget
|
|
131
|
-
imageLoadedListener = null;
|
|
132
|
-
}
|
|
133
|
-
update();
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
// seems like apple users north west, south east
|
|
138
|
-
// google uses north east, south west
|
|
139
|
-
private static LatLngBounds fixBoundsIfNecessary(ReadableArray bounds){
|
|
140
|
-
double lat1 = bounds.getArray(0).getDouble(0);
|
|
141
|
-
double lon1 = bounds.getArray(0).getDouble(1);
|
|
142
|
-
double lat2 = bounds.getArray(1).getDouble(0);
|
|
143
|
-
double lon2 = bounds.getArray(1).getDouble(1);
|
|
51
|
+
private String imageUri;
|
|
52
|
+
|
|
53
|
+
private GroundOverlayOptions groundOverlayOptions;
|
|
54
|
+
private GroundOverlay groundOverlay;
|
|
55
|
+
private LatLngBounds bounds;
|
|
56
|
+
private float bearing;
|
|
57
|
+
private BitmapDescriptor bitmapDescriptor;
|
|
58
|
+
private boolean tappable;
|
|
59
|
+
private float zIndex;
|
|
60
|
+
private float transparency;
|
|
61
|
+
|
|
62
|
+
private DataSource<CloseableReference<CloseableImage>> dataSource;
|
|
63
|
+
|
|
64
|
+
private GroundOverlayManager.Collection groundOverlayCollection;
|
|
65
|
+
|
|
66
|
+
private ImageManager.OnImageLoadedListener imageLoadedListener;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
public MapOverlay(Context context) {
|
|
70
|
+
super(context);
|
|
71
|
+
transparency = 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private GenericDraweeHierarchy createDraweeHierarchy() {
|
|
75
|
+
return new GenericDraweeHierarchyBuilder(getResources())
|
|
76
|
+
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
|
|
77
|
+
.setFadeDuration(0)
|
|
78
|
+
.build();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
// seems like apple users north west, south east
|
|
83
|
+
// google uses north east, south west
|
|
84
|
+
private static LatLngBounds fixBoundsIfNecessary(ReadableArray bounds) {
|
|
85
|
+
double lat1 = bounds.getArray(0).getDouble(0);
|
|
86
|
+
double lon1 = bounds.getArray(0).getDouble(1);
|
|
87
|
+
double lat2 = bounds.getArray(1).getDouble(0);
|
|
88
|
+
double lon2 = bounds.getArray(1).getDouble(1);
|
|
144
89
|
|
|
145
90
|
// Ensure lat1/lon1 is the SW corner and lat2/lon2 is the NE corner
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
91
|
+
double southLat = Math.min(lat1, lat2);
|
|
92
|
+
double northLat = Math.max(lat1, lat2);
|
|
93
|
+
double westLon = Math.min(lon1, lon2);
|
|
94
|
+
double eastLon = Math.max(lon1, lon2);
|
|
150
95
|
|
|
151
96
|
// Create corrected LatLngs
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
97
|
+
LatLng sw = new LatLng(southLat, westLon);
|
|
98
|
+
LatLng ne = new LatLng(northLat, eastLon);
|
|
99
|
+
return new LatLngBounds(sw, ne);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public void setBounds(ReadableArray bounds) {
|
|
156
103
|
|
|
157
|
-
|
|
104
|
+
this.bounds = fixBoundsIfNecessary(bounds);
|
|
105
|
+
if (this.groundOverlay != null) {
|
|
106
|
+
this.groundOverlay.setPositionFromBounds(this.bounds);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
158
109
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
110
|
+
public void setBearing(float bearing) {
|
|
111
|
+
this.bearing = bearing;
|
|
112
|
+
if (this.groundOverlay != null) {
|
|
113
|
+
this.groundOverlay.setBearing(bearing);
|
|
114
|
+
}
|
|
162
115
|
}
|
|
163
|
-
}
|
|
164
116
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
117
|
+
public void setZIndex(float zIndex) {
|
|
118
|
+
this.zIndex = zIndex;
|
|
119
|
+
if (this.groundOverlay != null) {
|
|
120
|
+
this.groundOverlay.setZIndex(zIndex);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public void setTransparency(float transparency) {
|
|
125
|
+
this.transparency = transparency;
|
|
126
|
+
if (groundOverlay != null) {
|
|
127
|
+
groundOverlay.setTransparency(transparency);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
public void setImage(String uri) {
|
|
133
|
+
boolean shouldLoadImage = true;
|
|
134
|
+
|
|
135
|
+
this.imageUri = uri;
|
|
136
|
+
if (!shouldLoadImage) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (uri == null) {
|
|
141
|
+
bitmapDescriptor = null;
|
|
142
|
+
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
|
|
143
|
+
uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
|
|
144
|
+
|
|
145
|
+
ImageRequest imageRequest = ImageRequestBuilder
|
|
146
|
+
.newBuilderWithSource(Uri.parse(uri))
|
|
147
|
+
.build();
|
|
148
|
+
|
|
149
|
+
ImagePipeline imagePipeline = Fresco.getImagePipeline();
|
|
150
|
+
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
|
|
151
|
+
|
|
152
|
+
DataSubscriber<CloseableReference<CloseableImage>> subscriber = new BaseDataSubscriber<CloseableReference<CloseableImage>>() {
|
|
153
|
+
@Override
|
|
154
|
+
protected void onNewResultImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
|
|
155
|
+
if (!dataSource.isFinished()) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
CloseableReference<CloseableImage> imageReference = dataSource.getResult();
|
|
160
|
+
if (imageReference != null) {
|
|
161
|
+
try {
|
|
162
|
+
CloseableImage closeableImage = imageReference.get();
|
|
163
|
+
if (closeableImage instanceof CloseableBitmap) {
|
|
164
|
+
Bitmap bitmap = ((CloseableBitmap) closeableImage).getUnderlyingBitmap();
|
|
165
|
+
if (bitmap != null) {
|
|
166
|
+
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} finally {
|
|
170
|
+
CloseableReference.closeSafely(imageReference);
|
|
171
|
+
}
|
|
172
|
+
new Handler(Looper.getMainLooper()).post(() -> update());
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@Override
|
|
177
|
+
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
|
|
178
|
+
// Handle failure
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
dataSource.subscribe(subscriber, Executors.newSingleThreadExecutor());
|
|
183
|
+
|
|
184
|
+
} else {
|
|
185
|
+
bitmapDescriptor = getBitmapDescriptorByName(uri);
|
|
186
|
+
}
|
|
169
187
|
}
|
|
170
|
-
}
|
|
171
188
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.groundOverlay.setZIndex(zIndex);
|
|
189
|
+
|
|
190
|
+
private BitmapDescriptor getBitmapDescriptorByName(String name) {
|
|
191
|
+
return BitmapDescriptorFactory.fromResource(getDrawableResourceByName(name));
|
|
176
192
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
public void setImage(String uri) {
|
|
187
|
-
this.mImageReader.setImage(uri);
|
|
188
|
-
boolean shouldLoadImage = true;
|
|
189
|
-
|
|
190
|
-
this.imageUri = uri;
|
|
191
|
-
if (!shouldLoadImage) {return;}
|
|
192
|
-
|
|
193
|
-
if (uri == null) {
|
|
194
|
-
iconBitmapDescriptor = null;
|
|
195
|
-
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
|
|
196
|
-
uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
|
|
197
|
-
ImageRequest imageRequest = ImageRequestBuilder
|
|
198
|
-
.newBuilderWithSource(Uri.parse(uri))
|
|
199
|
-
.build();
|
|
200
|
-
|
|
201
|
-
ImagePipeline imagePipeline = Fresco.getImagePipeline();
|
|
202
|
-
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
|
|
203
|
-
DraweeController controller = Fresco.newDraweeControllerBuilder()
|
|
204
|
-
.setImageRequest(imageRequest)
|
|
205
|
-
.setControllerListener(mLogoControllerListener)
|
|
206
|
-
.setOldController(logoHolder.getController())
|
|
207
|
-
.build();
|
|
208
|
-
logoHolder.setController(controller);
|
|
209
|
-
} else {
|
|
210
|
-
iconBitmapDescriptor = getBitmapDescriptorByName(uri);
|
|
211
|
-
int drawableId = getDrawableResourceByName(uri);
|
|
212
|
-
iconBitmap = BitmapFactory.decodeResource(getResources(), drawableId);
|
|
213
|
-
if (iconBitmap == null) { // VectorDrawable or similar
|
|
214
|
-
Drawable drawable = getResources().getDrawable(drawableId);
|
|
215
|
-
iconBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
|
216
|
-
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
|
217
|
-
Canvas canvas = new Canvas(iconBitmap);
|
|
218
|
-
drawable.draw(canvas);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
}
|
|
193
|
+
|
|
194
|
+
private int getDrawableResourceByName(String name) {
|
|
195
|
+
return getResources().getIdentifier(
|
|
196
|
+
name,
|
|
197
|
+
"drawable",
|
|
198
|
+
getContext().getPackageName());
|
|
222
199
|
}
|
|
223
200
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return getResources().getIdentifier(
|
|
230
|
-
name,
|
|
231
|
-
"drawable",
|
|
232
|
-
getContext().getPackageName());
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
public void setTappable(boolean tapabble) {
|
|
236
|
-
this.tappable = tapabble;
|
|
237
|
-
if (groundOverlay != null) {
|
|
238
|
-
groundOverlay.setClickable(tappable);
|
|
201
|
+
public void setTappable(boolean tapabble) {
|
|
202
|
+
this.tappable = tapabble;
|
|
203
|
+
if (groundOverlay != null) {
|
|
204
|
+
groundOverlay.setClickable(tappable);
|
|
205
|
+
}
|
|
239
206
|
}
|
|
240
|
-
}
|
|
241
207
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
208
|
+
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
209
|
+
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
210
|
+
builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
|
|
211
|
+
return builder.build();
|
|
212
|
+
}
|
|
247
213
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
214
|
+
public GroundOverlayOptions getGroundOverlayOptions() {
|
|
215
|
+
if (this.groundOverlayOptions == null) {
|
|
216
|
+
this.groundOverlayOptions = createGroundOverlayOptions();
|
|
217
|
+
}
|
|
218
|
+
return this.groundOverlayOptions;
|
|
251
219
|
}
|
|
252
|
-
return this.groundOverlayOptions;
|
|
253
|
-
}
|
|
254
220
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
221
|
+
private GroundOverlayOptions createGroundOverlayOptions() {
|
|
222
|
+
if (this.groundOverlayOptions != null) {
|
|
223
|
+
return this.groundOverlayOptions;
|
|
224
|
+
}
|
|
225
|
+
GroundOverlayOptions options = new GroundOverlayOptions();
|
|
226
|
+
if (this.bitmapDescriptor != null) {
|
|
227
|
+
options.image(bitmapDescriptor);
|
|
228
|
+
} else {
|
|
229
|
+
// add stub image to be able to instantiate the overlay
|
|
230
|
+
// and store a reference to it in MapView
|
|
231
|
+
options.image(BitmapDescriptorFactory.defaultMarker());
|
|
232
|
+
// hide overlay until real image gets added
|
|
233
|
+
options.visible(false);
|
|
234
|
+
}
|
|
235
|
+
options.positionFromBounds(bounds);
|
|
236
|
+
options.zIndex(zIndex);
|
|
237
|
+
options.bearing(bearing);
|
|
238
|
+
// options.transparency(transparency);
|
|
239
|
+
return options;
|
|
258
240
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// add stub image to be able to instantiate the overlay
|
|
264
|
-
// and store a reference to it in MapView
|
|
265
|
-
options.image(BitmapDescriptorFactory.defaultMarker());
|
|
266
|
-
// hide overlay until real image gets added
|
|
267
|
-
options.visible(false);
|
|
241
|
+
|
|
242
|
+
@Override
|
|
243
|
+
public Object getFeature() {
|
|
244
|
+
return groundOverlay;
|
|
268
245
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
@Override
|
|
282
|
-
public void addToMap(Object collection) {
|
|
283
|
-
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
284
|
-
GroundOverlayOptions groundOverlayOptions = getGroundOverlayOptions();
|
|
285
|
-
if (groundOverlayOptions != null) {
|
|
286
|
-
groundOverlay = groundOverlayCollection.addGroundOverlay(groundOverlayOptions);
|
|
287
|
-
groundOverlay.setClickable(this.tappable);
|
|
288
|
-
} else {
|
|
289
|
-
this.groundOverlayCollection = groundOverlayCollection;
|
|
246
|
+
|
|
247
|
+
@Override
|
|
248
|
+
public void addToMap(Object collection) {
|
|
249
|
+
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
250
|
+
GroundOverlayOptions groundOverlayOptions = getGroundOverlayOptions();
|
|
251
|
+
if (groundOverlayOptions != null) {
|
|
252
|
+
groundOverlay = groundOverlayCollection.addGroundOverlay(groundOverlayOptions);
|
|
253
|
+
groundOverlay.setClickable(this.tappable);
|
|
254
|
+
} else {
|
|
255
|
+
this.groundOverlayCollection = groundOverlayCollection;
|
|
256
|
+
}
|
|
290
257
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
258
|
+
|
|
259
|
+
@Override
|
|
260
|
+
public void removeFromMap(Object collection) {
|
|
261
|
+
if (groundOverlay != null) {
|
|
262
|
+
GroundOverlayManager.Collection groundOverlayCollection = (GroundOverlayManager.Collection) collection;
|
|
263
|
+
groundOverlayCollection.remove(groundOverlay);
|
|
264
|
+
groundOverlay = null;
|
|
265
|
+
groundOverlayOptions = null;
|
|
266
|
+
}
|
|
267
|
+
groundOverlayCollection = null;
|
|
300
268
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
@Override
|
|
305
|
-
public void setIconBitmap(Bitmap bitmap) {
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
@Override
|
|
309
|
-
public void setIconBitmapDescriptor(
|
|
310
|
-
BitmapDescriptor iconBitmapDescriptor) {
|
|
311
|
-
this.iconBitmapDescriptor = iconBitmapDescriptor;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
@Override
|
|
315
|
-
public void update() {
|
|
316
|
-
this.groundOverlay = getGroundOverlay();
|
|
317
|
-
if (this.groundOverlay != null) {
|
|
318
|
-
this.groundOverlay.setVisible(true);
|
|
319
|
-
this.groundOverlay.setImage(this.iconBitmapDescriptor);
|
|
320
|
-
this.groundOverlay.setTransparency(this.transparency);
|
|
321
|
-
this.groundOverlay.setClickable(this.tappable);
|
|
269
|
+
|
|
270
|
+
@Override
|
|
271
|
+
public void setIconBitmap(Bitmap bitmap) {
|
|
322
272
|
}
|
|
323
|
-
}
|
|
324
273
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
274
|
+
@Override
|
|
275
|
+
public void setBitmapDescriptor(
|
|
276
|
+
BitmapDescriptor bitmapDescriptor) {
|
|
277
|
+
this.bitmapDescriptor = bitmapDescriptor;
|
|
328
278
|
}
|
|
329
|
-
|
|
330
|
-
|
|
279
|
+
|
|
280
|
+
@Override
|
|
281
|
+
public void update() {
|
|
282
|
+
this.groundOverlay = getGroundOverlay();
|
|
283
|
+
if (this.groundOverlay != null) {
|
|
284
|
+
this.groundOverlay.setVisible(true);
|
|
285
|
+
this.groundOverlay.setImage(this.bitmapDescriptor);
|
|
286
|
+
// this.groundOverlay.setTransparency(this.transparency);
|
|
287
|
+
this.groundOverlay.setClickable(this.tappable);
|
|
288
|
+
}
|
|
331
289
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
290
|
+
|
|
291
|
+
private GroundOverlay getGroundOverlay() {
|
|
292
|
+
if (this.groundOverlay != null) {
|
|
293
|
+
return this.groundOverlay;
|
|
294
|
+
}
|
|
295
|
+
if (this.groundOverlayCollection == null) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
GroundOverlayOptions groundOverlayOptions = getGroundOverlayOptions();
|
|
299
|
+
if (groundOverlayOptions != null) {
|
|
300
|
+
return this.groundOverlayCollection.addGroundOverlay(groundOverlayOptions);
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
335
303
|
}
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
304
|
}
|
package/lib/MapOverlay.js
CHANGED
|
@@ -54,7 +54,6 @@ class MapOverlay extends React.Component {
|
|
|
54
54
|
image = resolvedImage.uri || this.props.image;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
console.log('MapOverlay image: ' + image);
|
|
58
57
|
return (<AIRMapOverlay {...this.props} opacity={opacity}
|
|
59
58
|
// @ts-ignore
|
|
60
59
|
image={image} style={[styles.overlay, this.props.style]}/>);
|
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.
|
|
8
|
+
"version": "1.21.0-alpha.84",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|