// // Marker related listeners. // public bool OnMarkerClick(Marker marker) { // This causes the marker at Perth to bounce into position when it is clicked. if (marker.Equals(mPerth)) { Handler handler = new Handler (); long start = SystemClock.UptimeMillis (); Projection proj = mMap.Projection; Point startPoint = proj.ToScreenLocation(PERTH); startPoint.Offset(0, -100); LatLng startLatLng = proj.FromScreenLocation(startPoint); long duration = 1500; IInterpolator interpolator = new BounceInterpolator(); Runnable run = null; run = new Runnable (delegate { long elapsed = SystemClock.UptimeMillis () - start; float t = interpolator.GetInterpolation ((float) elapsed / duration); double lng = t * PERTH.Longitude + (1 - t) * startLatLng.Longitude; double lat = t * PERTH.Latitude + (1 - t) * startLatLng.Latitude; marker.Position = (new LatLng(lat, lng)); if (t < 1.0) { // Post again 16ms later. handler.PostDelayed(run, 16); } }); handler.Post(run); } // We return false to indicate that we have not consumed the event and that we wish // for the default behavior to occur (which is for the camera to move such that the // marker is centered and for the marker's info window to open, if it has one). return false; }
private void Render (Marker marker, View view) { int badge; // Use the equals() method on a Marker to check for equals. Do not use ==. if (marker.Equals(parent.mBrisbane)) { badge = Resource.Drawable.badge_qld; } else if (marker.Equals(parent.mAdelaide)) { badge = Resource.Drawable.badge_sa; } else if (marker.Equals(parent.mSydney)) { badge = Resource.Drawable.badge_nsw; } else if (marker.Equals(parent.mMelbourne)) { badge = Resource.Drawable.badge_victoria; } else if (marker.Equals(parent.mPerth)) { badge = Resource.Drawable.badge_wa; } else { // Passing 0 to setImageResource will clear the image view. badge = 0; } ((ImageView) view.FindViewById (Resource.Id.badge)).SetImageResource (badge); String title = marker.Title; TextView titleUi = ((TextView) view.FindViewById (Resource.Id.title)); if (title != null) { // Spannable string allows us to edit the formatting of the text. SpannableString titleText = new SpannableString (title); SpanTypes st = (SpanTypes) 0; // FIXME: this somehow rejects to compile //titleText.SetSpan (new ForegroundColorSpan(Color.Red), 0, titleText.Length, st); titleUi.TextFormatted = (titleText); } else { titleUi.Text = (""); } String snippet = marker.Snippet; TextView snippetUi = ((TextView) view.FindViewById(Resource.Id.snippet)); if (snippet != null) { SpannableString snippetText = new SpannableString(snippet); snippetText.SetSpan(new ForegroundColorSpan(Color.Magenta), 0, 10, 0); snippetText.SetSpan(new ForegroundColorSpan(Color.Blue), 12, 21, 0); snippetUi.TextFormatted = (snippetText); } else { snippetUi.Text = (""); } }
public bool OnMarkerClick(Marker marker) { if(marker.Equals(currentLocationMarker)) { if (_markerClick) { CameraPosition pos = new CameraPosition.Builder ().Target (coord).Zoom (17).Tilt (90).Build (); map.AnimateCamera (CameraUpdateFactory.NewCameraPosition (pos)); } else { CameraPosition pos = new CameraPosition.Builder ().Target (coord).Zoom (17).Build (); map.AnimateCamera (CameraUpdateFactory.NewCameraPosition (pos)); //CameraUpdate update = CameraUpdateFactory.NewLatLngZoom(coord, 17); //map.AnimateCamera(update); } } _markerClick = !_markerClick; return true; }