Example #1
0
        protected override void Init()
        {
            _beforeTest = Application.Current.On <Android>().GetWindowSoftInputModeAdjust();

            Application.Current.On <Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
            PushAsync(Root());
        }
Example #2
0
        void SetSoftInputMode()
        {
            var adjust = SoftInput.AdjustPan;

            if (Xamarin.Forms.Application.Current != null)
            {
                WindowSoftInputModeAdjust elementValue = Xamarin.Forms.Application.Current.OnThisPlatform().GetWindowSoftInputModeAdjust();
                switch (elementValue)
                {
                case WindowSoftInputModeAdjust.Resize:
                    adjust = SoftInput.AdjustResize;
                    break;

                case WindowSoftInputModeAdjust.Unspecified:
                    adjust = SoftInput.AdjustUnspecified;
                    break;

                default:
                    adjust = SoftInput.AdjustPan;
                    break;
                }
            }

            Window.SetSoftInputMode(adjust);
        }
Example #3
0
        public static void UpdateWindowSoftInputModeAdjust(this AApplication platformView, Application application)
        {
            var adjust = SoftInput.AdjustPan;

            if (Application.Current != null)
            {
                WindowSoftInputModeAdjust elementValue = Application.Current.OnThisPlatform().GetWindowSoftInputModeAdjust();

                switch (elementValue)
                {
                case WindowSoftInputModeAdjust.Resize:
                    adjust = SoftInput.AdjustResize;
                    break;

                case WindowSoftInputModeAdjust.Unspecified:
                    adjust = SoftInput.AdjustUnspecified;
                    break;

                default:
                    adjust = SoftInput.AdjustPan;
                    break;
                }
            }

            IMauiContext mauiContext = application.FindMauiContext(true);
            Context      context     = mauiContext?.Context;
            Activity     activity    = context.GetActivity();

            activity?.Window?.SetSoftInputMode(adjust);
        }
Example #4
0
        static Button GetButton(WindowSoftInputModeAdjust value)
        {
            var button = new Button {
                Text = value.ToString(), Margin = 20
            };

            button.Clicked += (sender, args) =>
            {
                Application.Current.On <Android>().UseWindowSoftInputModeAdjust(value);
            };
            return(button);
        }
        protected override void OnParentSet()
        {
            base.OnParentSet();

            if (Device.RuntimePlatform == Device.Android)
            {
                if (this.Parent != null)
                {
                    if (this.lastInputMode == WindowSoftInputModeAdjust.Unspecified)
                    {
                        this.lastInputMode = GetSoftInputMode();
                    }

                    SetSoftInputMode(WindowSoftInputModeAdjust.Resize);
                }
                else
                {
                    SetSoftInputMode(this.lastInputMode);
                }
            }
        }
Example #6
0
 public static IPlatformElementConfiguration <Android, FormsElement> UseWindowSoftInputModeAdjust(this IPlatformElementConfiguration <Android, FormsElement> config, WindowSoftInputModeAdjust value)
 {
     SetWindowSoftInputModeAdjust(config.Element, value);
     return(config);
 }
Example #7
0
 public static void SetWindowSoftInputModeAdjust(BindableObject element, WindowSoftInputModeAdjust value)
 {
     element.SetValue(WindowSoftInputModeAdjustProperty, value);
 }
 public void UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust modeAdjust)
 {
 }
 private static void SetSoftInputMode(WindowSoftInputModeAdjust inputMode)
 {
     AndroidApplication.SetWindowSoftInputModeAdjust(Xamarin.Forms.Application.Current, inputMode);
 }