using Android.Content;
using Pixiview.Droid.Renderers;
using Pixiview.UI;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(BlurryPanel), typeof(BlurryPanelRenderer))]
namespace Pixiview.Droid.Renderers
{
    public class BlurryPanelRenderer : ViewRenderer
    {
        public BlurryPanelRenderer(Context context) : base(context)
        {
        }

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

            if (e.NewElement != null)
            {
                var color = e.NewElement.BackgroundColor;
                if (!color.IsDefault)
                {
                    SetBackgroundColor(color.MultiplyAlpha(.94).ToAndroid());
                }
            }
        }
    }
}
