<commit_before>using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Views;
using Perspex.Android.Platform.Specific;
using Perspex.Android.Platform.Specific.Helpers;
using Perspex.Input;
using Perspex.Input.Raw;
using Perspex.Platform;
using Perspex.Skia.Android;
using System;
using Perspex.Controls;

namespace Perspex.Android.Platform.SkiaPlatform
{
    public class WindowImpl : SkiaView, IAndroidView, IWindowImpl, ISurfaceHolderCallback
    {
        protected AndroidKeyboardEventsHelper<WindowImpl> _keyboardHelper;

        private AndroidTouchEventsHelper<WindowImpl> _touchHelper;

        public WindowImpl(Context context) : base((Activity)context)
        {
            _keyboardHelper = new AndroidKeyboardEventsHelper<WindowImpl>(this);
            _touchHelper = new AndroidTouchEventsHelper<WindowImpl>(this, () => InputRoot, p => GetPerspexPointFromEvent(p));

            MaxClientSize = new Size(Resources.DisplayMetrics.WidthPixels, Resources.DisplayMetrics.HeightPixels);
            ClientSize = MaxClientSize;
            Init();
        }

        public WindowImpl() : this(PerspexLocator.Current.GetService<IAndroidActivity>().Activity)
        {
        }

        void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
        {
            var newSize = new Size(width, height);
            if (newSize != ClientSize)
            {
                MaxClientSize = newSize;
                ClientSize = newSize;
                Resized?.Invoke(ClientSize);
            }

            base.SurfaceChanged(holder, format, width, height);
        }

        protected virtual void Init()
        {
        }

        private bool _handleEvents;

        public bool HandleEvents
        {
            get { return _handleEvents; }
            set
            {
                _handleEvents = value;
                _keyboardHelper.HandleEvents = _handleEvents;
            }
        }
        public WindowState WindowState
        {
            get { return WindowState.Normal; }
            set { }
        }

        public virtual Point GetPerspexPointFromEvent(MotionEvent e) => new Point(e.GetX(), e.GetY());

        public IInputRoot InputRoot { get; private set; }

        public Size ClientSize { get; set; }

        public Action Closed { get; set; }

        public Action Deactivated { get; set; }

        public Action<RawInputEventArgs> Input { get; set; }

        public Size MaxClientSize { get; private set; }

        public Action<Rect> Paint { get; set; }

        public Action<Size> Resized { get; set; }

        public View View => this;

        Action ITopLevelImpl.Activated { get; set; }

        IPlatformHandle ITopLevelImpl.Handle => this;

        public void Activate()
        {
        }

        public void Hide()
        {
            this.Visibility = ViewStates.Invisible;
        }

        public void SetSystemDecorations(bool enabled)
        {
        }
        public void Invalidate(Rect rect)
        {
            if (Holder?.Surface?.IsValid == true) base.Invalidate();
        }

        public Point PointToScreen(Point point)
        {
            return point;<commit_msg>Fix failing android build.<commit_after>using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Views;
using Perspex.Android.Platform.Specific;
using Perspex.Android.Platform.Specific.Helpers;
using Perspex.Input;
using Perspex.Input.Raw;
using Perspex.Platform;
using Perspex.Skia.Android;
using System;
using Perspex.Controls;

namespace Perspex.Android.Platform.SkiaPlatform
{
    public class WindowImpl : SkiaView, IAndroidView, IWindowImpl, ISurfaceHolderCallback
    {
        protected AndroidKeyboardEventsHelper<WindowImpl> _keyboardHelper;

        private AndroidTouchEventsHelper<WindowImpl> _touchHelper;

        public WindowImpl(Context context) : base((Activity)context)
        {
            _keyboardHelper = new AndroidKeyboardEventsHelper<WindowImpl>(this);
            _touchHelper = new AndroidTouchEventsHelper<WindowImpl>(this, () => InputRoot, p => GetPerspexPointFromEvent(p));

            MaxClientSize = new Size(Resources.DisplayMetrics.WidthPixels, Resources.DisplayMetrics.HeightPixels);
            ClientSize = MaxClientSize;
            Init();
        }

        public WindowImpl() : this(PerspexLocator.Current.GetService<IAndroidActivity>().Activity)
        {
        }

        void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
        {
            var newSize = new Size(width, height);
            if (newSize != ClientSize)
            {
                MaxClientSize = newSize;
                ClientSize = newSize;
                Resized?.Invoke(ClientSize);
            }

            base.SurfaceChanged(holder, format, width, height);
        }

        protected virtual void Init()
        {
        }

        private bool _handleEvents;

        public bool HandleEvents
        {
            get { return _handleEvents; }
            set
            {
                _handleEvents = value;
                _keyboardHelper.HandleEvents = _handleEvents;
            }
        }
        public WindowState WindowState
        {
            get { return WindowState.Normal; }
            set { }
        }

        public virtual Point GetPerspexPointFromEvent(MotionEvent e) => new Point(e.GetX(), e.GetY());

        public IInputRoot InputRoot { get; private set; }

        public Size ClientSize { get; set; }

        public Action Closed { get; set; }

        public Action Deactivated { get; set; }

        public Action<RawInputEventArgs> Input { get; set; }

        public Size MaxClientSize { get; private set; }

        public Action<Rect> Paint { get; set; }

        public Action<Size> Resized { get; set; }

        public View View => this;

        Action ITopLevelImpl.Activated { get; set; }

        IPlatformHandle ITopLevelImpl.Handle => this;

        public void Activate()
        {
        }

        public void Hide()
        {
            this.Visibility = ViewStates.Invisible;
        }

        public void SetSystemDecorations(bool enabled)
        {
        }
        public void Invalidate(Rect rect)
        {
            if (Holder?.Surface?.IsValid == true) base.Invalidate();
        }

        public Point PointToClient(Point point)
        {
            return point;
        }

        public Point PointToScreen(Point point)
        {
            return point;
{'fraction_non_alphanumeric': 0.08211678832116788, 'fraction_numerical': 0.0, 'mean_word_length': 2.1141098484848486, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '531663', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1648, 'n_words': 408}