@@ -84,11 +84,10 @@ public void setCancelAction(Function<Void,VEntry> cancelAction) {
84
84
public void onResume () {
85
85
super .onResume ();
86
86
if (focusableEditText != null ) {
87
+ focusableEditText .clearFocus ();
87
88
focusableEditText .requestFocus ();
88
- InputMethodManager imm = (InputMethodManager ) requireActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
89
- imm .showSoftInput (focusableEditText , InputMethodManager .SHOW_FORCED );
90
- InputMethodManager inputMethodManager = (InputMethodManager ) requireActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
91
- inputMethodManager .toggleSoftInput (InputMethodManager .SHOW_FORCED , 0 );
89
+ InputMethodManager inputMethodManager = (InputMethodManager ) requireContext ().getSystemService (Context .INPUT_METHOD_SERVICE );
90
+ inputMethodManager .toggleSoftInput (InputMethodManager .SHOW_FORCED , InputMethodManager .HIDE_IMPLICIT_ONLY );
92
91
}
93
92
}
94
93
@@ -294,12 +293,9 @@ private View generateMeaning(final String meaning, final String hint,int image,
294
293
text .setSingleLine ();
295
294
296
295
if (focus ) {
297
- Log .d (TAG ,"requesting focus" );
298
- layout .requestFocus ();
299
- InputMethodManager imm = (InputMethodManager ) requireActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
300
- imm .showSoftInput (text , InputMethodManager .SHOW_FORCED );
301
- InputMethodManager inputMethodManager = (InputMethodManager ) requireActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
302
- inputMethodManager .toggleSoftInput (InputMethodManager .SHOW_FORCED , 0 );
296
+ Log .d (TAG ,"setting focus element" );
297
+ focusableEditText = text ;
298
+ focusableEditText .requestFocus ();
303
299
}
304
300
305
301
layout .setHint (hint );
0 commit comments