Exemple #1
0
        private void toggleKeyboard(OnscreenKeyboardMode mode)
        {
            RunOnUiThread(() =>
            {
                fireInputs    = false;
                editText.Text = "";
                fireInputs    = true;

                InputMethodManager inputMethod = GetSystemService(InputMethodService) as InputMethodManager;
                switch (mode)
                {
                case OnscreenKeyboardMode.Hidden:
                    inputMethod.HideSoftInputFromWindow(editText.WindowToken, 0);
                    break;

                case OnscreenKeyboardMode.Secure:
                    editText.InputType = InputTypes.TextVariationWebPassword;
                    inputMethod.ShowSoftInput(editText, ShowFlags.Forced);
                    break;

                //Make normal and default the same in case we add a type but we haven't added it here yet.
                case OnscreenKeyboardMode.Normal:
                default:
                    //editText.InputType = InputTypes.ClassText | InputTypes.TextFlagMultiLine; //Allows for autocorrect
                    editText.InputType = InputTypes.TextVariationWebPassword | InputTypes.TextFlagMultiLine;
                    inputMethod.ShowSoftInput(editText, ShowFlags.Forced);
                    break;
                }
            });
        }
Exemple #2
0
 public void Activate()
 {
     activity.RunOnUiThread(() =>
     {
         view.RequestFocus();
         inputMethodManager.ShowSoftInput(view, 0);
         view.KeyDown    += keyDown;
         view.CommitText += commitText;
     });
 }
        protected override void ActivateTextInput()
        {
            view.KeyDown    += keyDown;
            view.CommitText += commitText;

            activity.RunOnUiThread(() =>
            {
                view.RequestFocus();
                inputMethodManager?.ShowSoftInput(view, 0);
            });
        }
 public void SetActive(bool active)
 {
     if (active)
     {
         _host.RequestFocus();
         Reset();
         _imm.ShowSoftInput(_host, ShowFlags.Implicit);
     }
     else
     {
         _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.None);
     }
 }
        public void SetClient(ITextInputMethodClient client)
        {
            var active = client is { };

            if (active)
            {
                _host.RequestFocus();
                Reset();
                _imm.ShowSoftInput(_host, ShowFlags.Implicit);
            }
            else
            {
                _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.None);
            }
        }
Exemple #6
0
        /// <summary>
        /// Called when a UI element gets the focus and software keyboard should be opened
        /// Should return true if software keyboard is supported and will be shown
        /// </summary>
        public virtual bool Show(UIElement focusedElement)
        {
            //this.textBox = focusedElement as Noesis.TextBox;

            //if (this.textBox != null)
            //{
            //    this.textTask = WaveServices.Platform.ShowTextDialogBoxAsync("", "", this.textBox.Text);
            //    return true;
            //}

            var adapter = (Game.Current.Application.Adapter as Adapter);
            var view    = adapter.GameView;

            view.Focusable            = true;
            view.FocusableInTouchMode = true;
            view.RequestFocus();

            adapter.GameView.KeyPress -= GameView_KeyPress;
            adapter.GameView.KeyPress += GameView_KeyPress;

            Context c = adapter.Context;

            var keyboard = c.Resources.Configuration.Keyboard;

            if (keyboard == Android.Content.Res.KeyboardType.Nokeys)
            {
                InputMethodManager im = (InputMethodManager)c.GetSystemService(Context.InputMethodService);
                im.ShowSoftInput(view, ShowFlags.Forced);
            }

            return(false);
        }
Exemple #7
0
        public void ShowKeyboard(Activity activity, View view)
        {
            InputMethodManager inputMethodManager = (InputMethodManager)activity.GetSystemService(Context.InputMethodService);

            inputMethodManager.ShowSoftInput(view, ShowFlags.Forced);
            keyboardVisible = true;
        }
        private void FocusSearchBox()
        {
            SearchBox.RequestFocus();
            InputMethodManager imm = (InputMethodManager)GetSystemService(InputMethodService);

            imm.ShowSoftInput(SearchBox, ShowFlags.Implicit);
        }
Exemple #9
0
 public void HandleSearch(IMenuItem item)
 {
     if (_searchOpen)
     {
         ((BaseViewModel)ViewModel).ShowSpacer = false;
         SetSearchString();
         _actionBar.SetDisplayShowTitleEnabled(true);
         _actionBar.SetDisplayShowCustomEnabled(false);
         item.SetIcon(Resource.Drawable.ic_search_white);
         _imm.HideSoftInputFromWindow(Activity.CurrentFocus.WindowToken, 0);
     }
     else
     {
         ((BaseViewModel)ViewModel).ShowSpacer = true;
         if (!string.IsNullOrEmpty(_edtSearch.Text))
         {
             SetSearchString(_edtSearch.Text);
         }
         _actionBar.SetDisplayShowTitleEnabled(false);
         _actionBar.SetDisplayShowCustomEnabled(true);
         _edtSearch.RequestFocus();
         _imm.ShowSoftInput(_edtSearch, ShowFlags.Implicit);
         item.SetIcon(Resource.Drawable.ic_clear_white);
     }
     _searchOpen = !_searchOpen;
 }
Exemple #10
0
        private void ShowSearchView(ISearchableViewModel searchableViewModel)
        {
            MainActivity.TitleTextView.Visibility = ViewStates.Gone;

            var searchView = MainActivity.SearchView;

            searchView.Visibility = ViewStates.Visible;

            searchView.QueryHint = searchableViewModel.PlaceholderText;

            _searchTextChanged = searchableViewModel
                                 .Changed(() => searchableViewModel.SearchText)
                                 .Subscribe(searchText => searchView.SetQuery(searchText, false));

            _searchViewQueryChanged              = Observable.FromEventPattern <EventHandler <QueryTextChangeEventArgs>, QueryTextChangeEventArgs>(
                e => searchView.QueryTextChange += e,
                e => searchView.QueryTextChange -= e)
                                                   .Subscribe(ep => searchableViewModel.SearchText = ep.EventArgs.NewText);

            searchableViewModel.SearchText = string.Empty;

            searchView.RequestFocus();
            InputMethodManager imm = (InputMethodManager)MainActivity.GetSystemService(Context.InputMethodService);

            imm.ShowSoftInput(searchView, ShowFlags.Implicit);
        }
        public static void ShowKeyboard(View pView, InputMethodManager imm)
        {
            pView.RequestFocus();

            imm.ShowSoftInput(pView, ShowFlags.Forced);
            imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #12
0
        /// <summary>
        /// Attempts to force the keyboard to be displayed.
        /// </summary>
        /// <param name="focusedView">The UI element in focus that the keyboard should send keypresses to</param>
        public void ShowKeyboard(View focusedView)
        {
            InputMethodManager imm = (InputMethodManager)context.GetSystemService(Activity.InputMethodService);

            imm.ShowSoftInput(focusedView, ShowFlags.Forced);
            imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #13
0
        private void ActivateEditTextImpl()
        {
            if (activeEditText != null)
            {
                throw new Exception("Internal error: Can not activate edit text, another edit text is already active");
            }

            EnsureStaticEditText();

            activeEditText = this;
            editText       = staticEditText;

            // set up the initial state of the android EditText
            UpdateInputTypeImpl();

            editText.SetMaxLines(MaxLines);
            editText.SetMinLines(MinLines);

            UpdateTextToEditImpl();
            UpdateSelectionToEditImpl();

            // add callbacks
            editText.EditorAction     += AndroidEditTextOnEditorAction;
            editText.AfterTextChanged += AndroidEditTextOnAfterTextChanged;

            // add the edit to the overlay layout and show the layout
            GetGameContext().EditTextLayout.Visibility = ViewStates.Visible;

            // set the focus to the edit box
            editText.RequestFocus();

            // activate the ime (show the keyboard)
            inputMethodManager = (InputMethodManager)PlatformAndroid.Context.GetSystemService(Context.InputMethodService);
            inputMethodManager.ShowSoftInput(staticEditText, ShowFlags.Forced);
        }
Exemple #14
0
        private void ShowVirtualKeyboard()
        {
            InputMethodManager inputMethodManager = _context.GetSystemService(Context.InputMethodService) as InputMethodManager;

            inputMethodManager.ShowSoftInput(_password, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #15
0
        protected void ShowSoftKeyboard()
        {
            InputMethodManager mgr = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);

            mgr.ShowSoftInput(this.View, ShowFlags.Forced);
            mgr.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
        protected override void OnResume()
        {
            base.OnResume();
            _design.ReapplyTheme();

            CheckIfUnloaded();


            bool showKeyboard = ((!InitFingerprintUnlock()) || (Util.GetShowKeyboardDuringFingerprintUnlock(this)));

            EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);

            pwd.PostDelayed(() =>
            {
                InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
                if (showKeyboard)
                {
                    keyboard.ShowSoftInput(pwd, 0);
                }
                else
                {
                    keyboard.HideSoftInputFromWindow(pwd.WindowToken, HideSoftInputFlags.ImplicitOnly);
                }
            }, 50);

            _onResumeDone = true;
        }
Exemple #17
0
        protected override void OnResume()
        {
            base.OnResume();
            _design.ReapplyTheme();

            CheckIfUnloaded();


            bool showKeyboard = ((!InitFingerprintUnlock()) || (Util.GetShowKeyboardDuringFingerprintUnlock(this)));

            EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);

            pwd.PostDelayed(() =>
            {
                InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
                if (showKeyboard)
                {
                    keyboard.ShowSoftInput(pwd, 0);
                }
                else
                {
                    keyboard.HideSoftInputFromWindow(pwd.WindowToken, HideSoftInputFlags.ImplicitOnly);
                }
            }, 50);


            var btn = FindViewById <ImageButton>(Resource.Id.fingerprintbtn);

            btn.Click += (sender, args) =>
            {
                if (_biometryIdentifier.HasUserInterface || string.IsNullOrEmpty((string)btn.Tag))
                {
                    _biometryIdentifier.StartListening(this);
                }
                else
                {
                    AlertDialog.Builder b = new AlertDialog.Builder(this);
                    b.SetTitle(Resource.String.fingerprint_prefs);
                    b.SetMessage(btn.Tag.ToString());
                    b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
                    if (_biometryIdentifier != null)
                    {
                        b.SetNegativeButton(Resource.String.disable_sensor, (senderAlert, alertArgs) =>
                        {
                            btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
                            _biometryIdentifier?.StopListening();
                            _biometryIdentifier = null;
                        });
                    }
                    else
                    {
                        b.SetNegativeButton(Resource.String.enable_sensor, (senderAlert, alertArgs) =>
                        {
                            InitFingerprintUnlock();
                        });
                    }
                    b.Show();
                }
            };
        }
Exemple #18
0
        private async void ShowKeyboard()
        {
            await Task.Delay(50);

            InputMethodManager inputMethodManager = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);

            inputMethodManager.ShowSoftInput(_pinInputField, 0);
        }
Exemple #19
0
        public void ShowKeyboard()
        {
            RequestFocus();
            SoftKeyboardVisible = true;
            InputMethodManager mgr = (InputMethodManager)this.Context.GetSystemService(Context.InputMethodService);

            mgr.ShowSoftInput(this, ShowFlags.Forced);
        }
        //Shows the soft keyboard
        public void showSoftKeyboard(Android.App.Activity activity, View view)
        {
            InputMethodManager inputMethodManager = (InputMethodManager)activity.GetSystemService(Context.InputMethodService);

            view.RequestFocus();
            inputMethodManager.ShowSoftInput(view, 0);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);//personal line added
        }
        public static void ShowKeyboard(Context context, View pView)
        {
            pView.RequestFocus();
            InputMethodManager inputMethodManager = (InputMethodManager)context.GetSystemService(Context.InputMethodService);

            inputMethodManager.ShowSoftInput(pView, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #22
0
        protected internal void ShowKeyboard(AView inputView)
        {
            AObject temp = AndroidContext.GetSystemService(AContext.InputMethodService) ?? throw new NullReferenceException(nameof(Context.InputMethodService));

            using InputMethodManager inputMethodManager = (InputMethodManager)temp;
            inputMethodManager.ShowSoftInput(inputView, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #23
0
        private void CallKeyboard(EditText editText)
        {
            InputMethodManager inputMethodManager = this.GetSystemService(Context.InputMethodService) as InputMethodManager;

            inputMethodManager.ShowSoftInput(editText, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
            editText.RequestFocus();
        }
        public static void ShowKeyboard(Context ctx, View view, bool forced = false)
        {
            if (view == null)
            {
                view = new View(ctx);
            }
            InputMethodManager iMM = (InputMethodManager)ctx.GetSystemService(Context.InputMethodService);

            if (forced)
            {
                iMM.ShowSoftInput(view, ShowFlags.Forced);
            }
            else
            {
                iMM.ShowSoftInput(view, ShowFlags.Implicit);
            }
        }
        void anim_AnimationEndDown(object sender, Android.Views.Animations.Animation.AnimationEndEventArgs e)
        {
            mIsAnimating = false;
            mSearchEditText.RequestFocus();
            InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            inputManager.ShowSoftInput(mSearchEditText, ShowFlags.Implicit);
        }
Exemple #26
0
        protected override void InternalShowKeyboard(UIInputField inputField)
        {
            m_CurrentInput = inputField;
            InputMethodManager inputMethodManager = (InputMethodManager)Activity1.Instance.Application.GetSystemService(Context.InputMethodService);

            inputMethodManager.ShowSoftInput(Activity1.Instance.TheGame.Services.GetService <View>(), ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #27
0
        protected void ShowKeyboard(EditText editText)
        {
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            imm.ShowSoftInput(editText, ShowFlags.Forced);
            imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
            editText.SetSelection(editText.Text.Length);
        }
Exemple #28
0
        public void ShowKeyboard()
        {
            Control.RequestFocus();

            InputMethodManager inputMethodManager = Control.Context.GetSystemService(Context.InputMethodService) as InputMethodManager;

            inputMethodManager.ShowSoftInput(Control, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
        public void ShowKeyboard(View view)
        {
            view.RequestFocus();

            InputMethodManager inputMethodManager = Application.GetSystemService(InputMethodService) as InputMethodManager;

            inputMethodManager.ShowSoftInput(view, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }
Exemple #30
0
        private void ShowKeyboard(Android.Views.View view)
        {
            view.RequestFocus();

            InputMethodManager inputMethodManager = MainActivity.Context.GetSystemService(Context.InputMethodService) as InputMethodManager;

            inputMethodManager.ShowSoftInput(view, ShowFlags.Forced);
            inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
        }