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(OptionEditor), typeof(OptionEditorRenderer))]
namespace Billing.Droid.Renderers
{
    public class OptionEditorRenderer : EditorRenderer
    {
        public OptionEditorRenderer(Context context) : base(context)
        {
        }

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

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