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; }
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(); } }; }
public bool OnTouch(View v, MotionEvent e) { switch (e.Action & MotionEventActions.Mask) { case MotionEventActions.Up: if (lastFocusedControl != null) { lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_normal); } lastFocusedControl = (EditText)v; lastFocusedControl.SetBackgroundResource(Resource.Drawable.my_edit_text_background_focused); lastFocusedControl.RequestFocus(); EditText yourEditText = (EditText)v; Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)context.GetSystemService(Android.Content.Context.InputMethodService); imm.ShowSoftInput(yourEditText, Android.Views.InputMethods.ShowFlags.Forced); if (lastFocusedControl != null) { lastFocusedControl.PostDelayed(new Action(() => { lastFocusedControl.SelectAll(); }), 100); } break; } return(true); }
/// <summary> /// Switches to backup (password) screen. This either can happen when fingerprint is not /// available or the user chooses to use the password authentication method by pressing the /// button. This can also happen when the user had too many fingerprint attempts. /// </summary> void GoToBackup() { mStage = Stage.Password; UpdateStage(); mPassword.RequestFocus(); // Show the keyboard. mPassword.PostDelayed(ShowKeyboardRunnable, 500); // Fingerprint is not used anymore. Stop listening for it. mFingerprintUiHelper.StopListening(); }
public void FocusOnTextField() { _addressEditText.PostDelayed(() => { // if _collectionChangedSubscription is null, we left the screen if (_collectionChangedSubscription.Disposable != null) { _addressEditText.RequestFocusFromTouch(); _addressEditText.ShowKeyboard(); _addressEditText.SetCursorAtEnd(); } }, 400); }
public void ShowKeyboard(EditText editText) { if (editText != null) { editText.RequestFocus(); editText.PostDelayed(() => { var keyboard = Activity.GetSystemService(Context.InputMethodService) as InputMethodManager; if (keyboard != null) { keyboard.ShowSoftInput(editText, 0); } }, 50); } }
public void HideKeyboard(EditText editText) { if (editText != null) { editText.PostDelayed(() => { if (Activity != null) { var keyboard = Activity.GetSystemService(Context.InputMethodService) as InputMethodManager; if (keyboard != null) { keyboard.HideSoftInputFromWindow(editText.WindowToken, 0); } } }, 50); } }
public void SetHasFocus(bool hasFocus) { this.hasFocus = hasFocus; if (hasFocus) { Expand(); editText.PostDelayed(() => { editText.RequestFocusFromTouch(); inputMethodManager.ShowSoftInput(editText, 0); // added as keyboard doesnt auto show on edit text visibility. inputMethodManager.ToggleSoftInput(ShowFlags.Forced, 0); }, 300); } else { Reduce(); } }