public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) { int resId = 0; switch (descriptor.Id) { case "GREEN": resId = Resource.Drawable.active_lot; break; case "ORANGE": resId = Resource.Drawable.going_to_filled_out; break; case "RED": resId = Resource.Drawable.filled_lot; break; case "GREY": resId = Resource.Drawable.selected_lot; break; case "YELLOW": resId = Resource.Drawable.map_current; break; } return(AndroidBitmapDescriptorFactory.FromResource(resId)); }
public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) { switch (descriptor.Type) { case BitmapDescriptorType.Default: return(AndroidBitmapDescriptorFactory.DefaultMarker((float)((descriptor.Color.Hue * 360f) % 360f))); case BitmapDescriptorType.Bundle: var context = FormsGoogleMaps.Context; var resourceId = context.Resources.GetIdentifier(descriptor.BundleName, "drawable", context.PackageName); return(AndroidBitmapDescriptorFactory.FromResource(resourceId)); case BitmapDescriptorType.Stream: if (descriptor.Stream.CanSeek && descriptor.Stream.Position > 0) { descriptor.Stream.Position = 0; } return(AndroidBitmapDescriptorFactory.FromBitmap(BitmapFactory.DecodeStream(descriptor.Stream))); case BitmapDescriptorType.AbsolutePath: return(AndroidBitmapDescriptorFactory.FromPath(descriptor.AbsolutePath)); default: return(AndroidBitmapDescriptorFactory.DefaultMarker()); } }
public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) { switch (descriptor.Type) { case BitmapDescriptorType.Default: return(AndroidBitmapDescriptorFactory.DefaultMarker((float)((descriptor.Color.Hue * 360f) % 360f))); case BitmapDescriptorType.Bundle: return(AndroidBitmapDescriptorFactory.FromAsset(descriptor.BundleName)); case BitmapDescriptorType.Resource: var d = Xamarin.Forms.Platform.Android.ResourceManager.GetDrawableByName(descriptor.BundleName); if (d > 0) { return(AndroidBitmapDescriptorFactory.FromResource(d)); } else { return(AndroidBitmapDescriptorFactory.DefaultMarker()); } case BitmapDescriptorType.Stream: if (descriptor.Stream.CanSeek && descriptor.Stream.Position > 0) { descriptor.Stream.Position = 0; } return(AndroidBitmapDescriptorFactory.FromBitmap(BitmapFactory.DecodeStream(descriptor.Stream))); case BitmapDescriptorType.AbsolutePath: return(AndroidBitmapDescriptorFactory.FromPath(descriptor.AbsolutePath)); default: return(AndroidBitmapDescriptorFactory.DefaultMarker()); } }
public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) { int iconId = 0; switch (descriptor.Id) { case "tourist": iconId = Resource.Drawable.touristPin; break; case "home": iconId = Resource.Drawable.homePin; break; } return(AndroidBitmapDescriptorFactory.FromResource(iconId)); }
public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) { int resId = 0; switch (descriptor.Id) { case "type2": resId = Resource.Drawable.type2; break; case "type1": resId = Resource.Drawable.type1; break; } return(AndroidBitmapDescriptorFactory.FromResource(resId)); }