Skip to content

Commit 7d45c2a

Browse files
committed
feat: added routecode and fixed style issue
1 parent 570b525 commit 7d45c2a

1 file changed

Lines changed: 6 additions & 20 deletions

File tree

android/src/main/java/com/rnmaps/maps/MapView.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,8 @@ public void updateNearbyMarkersFromProcessedData(org.json.JSONArray processedMar
20412041
int size = markerData.optInt("size", 40);
20422042
String title = markerData.optString("title", "");
20432043
boolean rotationEnabled = markerData.optBoolean("rotationEnabled", false);
2044+
String routeCode = markerData.optString("routeCode", "");
2045+
20442046

20452047
seenDrivers.add(driverId);
20462048

@@ -2100,7 +2102,7 @@ public void updateNearbyMarkersFromProcessedData(org.json.JSONArray processedMar
21002102
Marker newMarker = markerCollection.addMarker(markerOptions);
21012103

21022104
if (newMarker != null) {
2103-
if(!isCluster) newMarker.setTag(driverId);
2105+
if(!isCluster && !routeCode.isEmpty()) newMarker.setTag(routeCode);
21042106
nearbyMarkersCache.put(driverId, newMarker);
21052107
}
21062108
if(!title.isEmpty()) {
@@ -2173,22 +2175,6 @@ private void animateMarkers(
21732175
}
21742176

21752177

2176-
// private void animateMarker(final Marker marker, final LatLng toPosition, int duration) {
2177-
// final LatLng startPosition = marker.getPosition();
2178-
// if (startPosition.equals(toPosition)) return;
2179-
2180-
// ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
2181-
// valueAnimator.setDuration(duration);
2182-
// valueAnimator.setInterpolator(new LinearInterpolator());
2183-
// valueAnimator.addUpdateListener(animation -> {
2184-
// float v = animation.getAnimatedFraction();
2185-
// double lng = v * toPosition.longitude + (1 - v) * startPosition.longitude;
2186-
// double lat = v * toPosition.latitude + (1 - v) * startPosition.latitude;
2187-
// marker.setPosition(new LatLng(lat, lng));
2188-
// });
2189-
// valueAnimator.start();
2190-
// }
2191-
21922178
// Get icon from assets with size reduction
21932179
private com.google.android.gms.maps.model.BitmapDescriptor getIconFromAssets(String vehicleVariant, double rotation, boolean isCluster, int clusterCount, int size, boolean rotationEnabled) {
21942180
try {
@@ -2260,9 +2246,9 @@ private com.google.android.gms.maps.model.BitmapDescriptor createScaledBitmapDes
22602246
android.graphics.Paint paint = new android.graphics.Paint();
22612247
paint.setAntiAlias(true);
22622248

2263-
float cx = widthPx / 2f;
2264-
float cy = heightPx * 0.63f;
2265-
float radius = Math.min(widthPx, heightPx) / 3f;
2249+
float cx = widthPx / 1.8f;
2250+
float cy = heightPx * 0.64f;
2251+
float radius = Math.min(widthPx, heightPx) / 2.4f;
22662252

22672253
paint.setColor(Color.WHITE);
22682254
canvas.drawCircle(cx, cy, radius, paint);

0 commit comments

Comments
 (0)