Fix bug causing cancellation of dialog fragment.

This commit is contained in:
Alex Hart 2022-04-14 14:54:40 -03:00 committed by Greyson Parrelli
parent 8da66bc789
commit c3e7d6c74c
2 changed files with 2 additions and 9 deletions

View file

@ -35,7 +35,7 @@ abstract class KeyboardEntryDialogFragment(@LayoutRes contentLayoutId: Int) :
dialog.window?.setDimAmount(0f)
}
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE or WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
return dialog
}

View file

@ -52,17 +52,10 @@ public final class ViewUtil {
}
public static void focusAndMoveCursorToEndAndOpenKeyboard(@NonNull EditText input) {
input.requestFocus();
int numberLength = input.getText().length();
input.setSelection(numberLength, numberLength);
InputMethodManager imm = (InputMethodManager) input.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);
if (!imm.isAcceptingText()) {
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
focusAndShowKeyboard(input);
}
public static void focusAndShowKeyboard(@NonNull View view) {