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

[assembly: ExportRenderer(typeof(AdaptedPage), typeof(AdaptedPageRenderer))]
namespace Pixiview.Droid.Renderers
{
    public class AdaptedPageRenderer : PageRenderer
    {
        public AdaptedPageRenderer(Context context) : base(context)
        {
        }

        protected override void OnAttachedToWindow()
        {
            base.OnAttachedToWindow();

            if (Element is AdaptedPage page)
            {
                page.OnLoad();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (Element is AdaptedPage page)
            {
                page.OnUnload();
            }

            base.Dispose(disposing);
        }

        //protected override void OnDetachedFromWindow()
        //{
        //    App.DebugPrint("detached from window");

        //    base.OnDetachedFromWindow();
        //}
    }
}
