Skip to content

Commit 4cac3d1

Browse files
committed
Fixed IME still shown after password setted
1 parent 5d24c59 commit 4cac3d1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/src/main/java/com/surcumference/fingerprint/view/PasswordInputView.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ private void initView(Context context) {
9090

9191
withPositiveButtonText(Lang.getString(R.id.ok));
9292
withOnPositiveButtonClickListener((dialog, which) -> {
93-
mInputView.clearFocus();
94-
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
95-
imm.hideSoftInputFromWindow(mInputView.getWindowToken(), 0);
93+
hideInputMethod();
9694
post(() -> {
9795
dialog.dismiss();
9896
});
@@ -123,6 +121,12 @@ protected void onAttachedToWindow() {
123121
imm.showSoftInput(mInputView, InputMethodManager.SHOW_IMPLICIT);
124122
}, 200);
125123
}
124+
public void hideInputMethod() {
125+
mInputView.clearFocus();
126+
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
127+
imm.hideSoftInputFromWindow(mInputView.getWindowToken(), 0);
128+
}
129+
126130

127131
@Override
128132
public AlertDialog showInDialog() {

app/src/main/java/com/surcumference/fingerprint/view/SettingsView.java

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ private void showUpdatePasswordViewDialog() {
187187
passwordInputView.setDefaultText(DEFAULT_HIDDEN_PASS);
188188
}
189189
passwordInputView.withOnPositiveButtonClickListener((dialog, which) -> {
190+
passwordInputView.hideInputMethod();
190191
String inputText = passwordInputView.getInput();
191192
if (TextUtils.isEmpty(inputText)) {
192193
config.setPasswordEncrypted("");

0 commit comments

Comments
 (0)