using System.ComponentModel;
using Android.Content;
using Android.Graphics.Drawables;
using Android.Text;
using InABox.Mobile;
using InABox.Mobile.Android;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(MobileEditor), typeof(MobileEditorRenderer))]
namespace InABox.Mobile.Android
{
    class MobileEditorRenderer : EditorRenderer
    {
        public MobileEditorRenderer(Context context) : base(context)
        {
        }

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

            if (Control != null)
            {
                GradientDrawable gd = new GradientDrawable();
                gd.SetColor(global::Android.Graphics.Color.Transparent);
                this.Control.SetBackgroundDrawable(gd);
                //this.Control.SetRawInputType(InputTypes.TextFlagNoSuggestions);
                //Control.SetHintTextColor(ColorStateList.ValueOf(global::Android.Graphics.Color.Black));
            }
        }
        
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            // if (Control != null)
            // {
            //     Control.RequestFocus();
            //     Control.SetSelection(0); //Control.Text.Length);                
            // }
        }       
    }
}