using Android.Content;
using Android.Graphics.Drawables;
using Billing.Droid.Renderers;
using Billing.UI;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(OptionTimePicker), typeof(OptionTimePickerRenderer))]
namespace Billing.Droid.Renderers
{
    public class OptionTimePickerRenderer : TimePickerRenderer
    {
        public OptionTimePickerRenderer(Context context) : base(context)
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var drawable = new ColorDrawable(e.NewElement.BackgroundColor.ToAndroid());
                Control.SetBackground(drawable);
            }
        }
    }
}