diff --git a/android/manifest b/android/manifest index 6c6ce06c..fea1a9ba 100644 --- a/android/manifest +++ b/android/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 5.6.1 +version: 5.6.2 apiversion: 4 architectures: arm64-v8a armeabi-v7a x86 x86_64 description: External version of Map module using native Google Maps library diff --git a/android/src/ti/map/TiClusterRenderer.java b/android/src/ti/map/TiClusterRenderer.java index 5065e59f..7b092012 100644 --- a/android/src/ti/map/TiClusterRenderer.java +++ b/android/src/ti/map/TiClusterRenderer.java @@ -5,6 +5,7 @@ import android.view.View; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.BitmapDescriptorFactory; +import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.maps.android.clustering.ClusterManager; @@ -111,7 +112,7 @@ protected void onClusterItemUpdated(TiMarker item, Marker marker) } // Update marker position if the item changed position if (!marker.getPosition().equals(item.getPosition())) { - if (item.getPosition() != null) { + if (!item.getPosition().equals(new LatLng(0, 0))) { marker.setPosition(item.getPosition()); } changed = true; diff --git a/android/src/ti/map/TiMarker.java b/android/src/ti/map/TiMarker.java index 449787f7..597c7e25 100644 --- a/android/src/ti/map/TiMarker.java +++ b/android/src/ti/map/TiMarker.java @@ -7,6 +7,7 @@ package ti.map; +import androidx.annotation.NonNull; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.maps.android.clustering.ClusterItem; @@ -48,13 +49,14 @@ public void release() } } + @NonNull @Override public LatLng getPosition() { if (proxy != null) { return proxy.getMarkerOptions().getPosition(); } - return null; + return new LatLng(0, 0); } @Override diff --git a/android/src/ti/map/TiUIMapView.java b/android/src/ti/map/TiUIMapView.java index f52b68c5..d89801c9 100644 --- a/android/src/ti/map/TiUIMapView.java +++ b/android/src/ti/map/TiUIMapView.java @@ -501,7 +501,9 @@ protected void showAnnotations(Object[] annotations) LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (TiMarker marker : markers) { - builder.include(marker.getPosition()); + if (!marker.getPosition().equals(new LatLng(0, 0))) { + builder.include(marker.getPosition()); + } } LatLngBounds bounds = builder.build(); @@ -645,7 +647,7 @@ protected void addAnnotation(AnnotationProxy annotation) // It is assigned to the TiMarker instance after it has been rendered in // onClusterItemRendered callback. tiMarker = new TiMarker(null, annotation); - if (mClusterManager != null) { + if (mClusterManager != null && tiMarker != null) { mClusterManager.addItem((TiMarker) tiMarker); mClusterManager.cluster(); }