Skip to content

Commit

Permalink
Fully initialize each marker before setting the fields (follow-up of #…
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Oct 9, 2017
1 parent 20dddc7 commit 6efc762
Showing 1 changed file with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,38 @@ public void getMapAsync(String apiKey)

private void initMarkers()
{
locationMarker = controller.addMarker();
locationMarker = createLocationMarker(3);
directionMarker = createDirectionMarker(2);
accuracyMarker = createAccuracyMarker(1);
}

private Marker createLocationMarker(int order)
{
Marker marker = controller.addMarker();
BitmapDrawable dot = createBitmapDrawableFrom(R.drawable.location_dot);
locationMarker.setStylingFromString("{ style: 'points', color: 'white', size: ["+TextUtils.join(",",sizeInDp(dot))+"], order: 2000, flat: true, collide: false }");
locationMarker.setDrawable(dot);
locationMarker.setDrawOrder(3);
marker.setStylingFromString("{ style: 'points', color: 'white', size: ["+TextUtils.join(",",sizeInDp(dot))+"], order: 2000, flat: true, collide: false }");
marker.setDrawable(dot);
marker.setDrawOrder(order);
return marker;
}

private Marker createDirectionMarker(int order)
{
BitmapDrawable directionImg = createBitmapDrawableFrom(R.drawable.location_direction);
directionMarkerSize = sizeInDp(directionImg);

directionMarker = controller.addMarker();
directionMarker.setDrawable(directionImg);
directionMarker.setDrawOrder(2);
Marker marker = controller.addMarker();
marker.setDrawable(directionImg);
marker.setDrawOrder(order);
return marker;
}

accuracyMarker = controller.addMarker();
accuracyMarker.setDrawable(createBitmapDrawableFrom(R.drawable.accuracy_circle));
accuracyMarker.setDrawOrder(1);
private Marker createAccuracyMarker(int order)
{
Marker marker = controller.addMarker();
marker.setDrawable(createBitmapDrawableFrom(R.drawable.accuracy_circle));
marker.setDrawOrder(order);
return marker;
}

private String[] sizeInDp(Drawable drawable)
Expand Down

0 comments on commit 6efc762

Please sign in to comment.