Bug fix: Plugin dont add all markers with custom icons to map with latest commit
MODIFY
src/android/plugin/google/maps/PluginAsyncInterface.java
src/android/plugin/google/maps/PluginAsyncInterface.java
package plugin.google.maps;
-
-public interface PluginAsyncInterface {
- public void onPostExecute(Object object);
- public void onError(String errorMsg);
+public interface AsyncLoadImageInterface {
+ public void onPostExecute(AsyncLoadImage.AsyncLoadImageResult result) ;
}

MODIFY
src/android/plugin/google/maps/PluginGroundOverlay.java
src/android/plugin/google/maps/PluginGroundOverlay.java
@@ -307,19 +307,20 @@ public class PluginGroundOverlay extends MyPlugin implements MyPluginInterface
callbackContext.success();
}
- private AsyncLoadImageInterface onComplete = new AsyncLoadImageInterface() {
- public GroundOverlayOptions options;
- public PluginAsyncInterface callback;
- public String imgUrl;
-
- @Override
- public void setParams(Object target, Object option, PluginAsyncInterface callback) {
- this.imgUrl = (String) target;
- this.options = (GroundOverlayOptions) option;
- this.callback = callback;
+ private void setImage_(final GroundOverlayOptions options, final String imgUrl, final PluginAsyncInterface callback) {
+ if (imgUrl == null) {
+ callback.onPostExecute(null);
+ return;
}
+ AsyncLoadImage.AsyncLoadImageOptions imageOptions = new AsyncLoadImage.AsyncLoadImageOptions();
+ imageOptions.height = -1;
+ imageOptions.width = -1;
+ imageOptions.noCaching = true;
+ imageOptions.url = imgUrl;
+ AsyncLoadImageInterface onComplete = new AsyncLoadImageInterface() {
+
@Override
public void onPostExecute(AsyncLoadImage.AsyncLoadImageResult result) {
imageLoadingTasks.remove(this.hashCode());
@@ -337,20 +338,6 @@ public class PluginGroundOverlay extends MyPlugin implements MyPluginInterface
}
};
-
-
- private void setImage_(final GroundOverlayOptions options, final String imgUrl, final PluginAsyncInterface callback) {
- if (imgUrl == null) {
- callback.onPostExecute(null);
- return;
- }
-
- AsyncLoadImage.AsyncLoadImageOptions imageOptions = new AsyncLoadImage.AsyncLoadImageOptions();
- imageOptions.height = -1;
- imageOptions.width = -1;
- imageOptions.noCaching = true;
- imageOptions.url = imgUrl;
-
final AsyncLoadImage task = new AsyncLoadImage(cordova, webView, imageOptions, onComplete);
//cordova.getActivity().runOnUiThread(new Runnable() {
// @Override

MODIFY
src/android/plugin/google/maps/PluginMarker.java
src/android/plugin/google/maps/PluginMarker.java
@@ -986,23 +986,7 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
options.height = height;
options.noCaching = noCaching;
- onComplete.setParams(marker, iconProperty, callback);
- AsyncLoadImage task = new AsyncLoadImage(cordova, webView, options, onComplete);
- task.execute();
- iconLoadingTasks.put(task.hashCode(), task);
- }
-
- private AsyncLoadImageInterface onComplete = new AsyncLoadImageInterface() {
- public Marker marker;
- public Bundle iconProperty;
- public PluginAsyncInterface callback;
-
- public void setParams(Object marker, Object iconProperty, PluginAsyncInterface callback) {
- this.marker = (Marker) marker;
- this.iconProperty = (Bundle) iconProperty;
- this.callback = callback;
- }
-
+ AsyncLoadImageInterface onComplete = new AsyncLoadImageInterface() {
@Override
public void onPostExecute(AsyncLoadImage.AsyncLoadImageResult result) {
iconLoadingTasks.remove(this.hashCode());
@@ -1116,6 +1100,12 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
}
};
+ AsyncLoadImage task = new AsyncLoadImage(cordova, webView, options, onComplete);
+ task.execute();
+ iconLoadingTasks.put(task.hashCode(), task);
+ }
+
+
private void _setIconAnchor(final Marker marker, double anchorX, double anchorY, final int imageWidth, final int imageHeight) {
// The `anchor` of the `icon` property
anchorX = anchorX * density;

Bug fix: Plugin dont add all markers with custom icons to map with latest commit #1684