Skip to content

Instantly share code, notes, and snippets.

@espritm
Created April 6, 2017 09:14
Show Gist options
  • Save espritm/b0176405bca5e0e355871c0a9aff59eb to your computer and use it in GitHub Desktop.
Save espritm/b0176405bca5e0e355871c0a9aff59eb to your computer and use it in GitHub Desktop.
public class CustomGoogleMapInfoWindow : Java.Lang.Object, GoogleMap.IInfoWindowAdapter
{
private Activity m_context;
private View m_View;
private Marker m_currentMarker;
public CustomGoogleMapInfoWindow(Activity context)
{
m_context = context;
m_View = m_context.LayoutInflater.Inflate(Resource.Layout.CustomGoogleMapInfoWindow, null);
}
public View GetInfoWindow(Marker marker)
{
//Use the default info window
return null;
}
public View GetInfoContents(Marker marker)
{
if (marker == null)
return null;
m_currentMarker = marker;
ImageView imageview = m_View.FindViewById<ImageView>(Resource.Id.CustomGoogleMapInfoWindow_imageview);
TextView textviewTitle = m_View.FindViewById<TextView>(Resource.Id.CustomGoogleMapInfoWindow_textview_title);
TextView textviewDescription = m_View.FindViewById<TextView>(Resource.Id.CustomGoogleMapInfoWindow_textview_description);
RatingBar ratingBar = m_View.FindViewById<RatingBar>(Resource.Id.CustomGoogleMapInfoWindow_ratingbar);
if (marker.Title != null && marker.Title.Contains("Grenoble"))
imageview.SetImageResource(Resource.Drawable.logo_grenoble);
textviewTitle.Text = marker.Title;
textviewDescription.Text = marker.Snippet;
ratingBar.Rating = 5;
return m_View;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment