Fix keyboard flashing white when closing

This commit is contained in:
SerpentSpirale 2021-09-02 07:02:19 +02:00
parent 3ac6a31685
commit af1a05003a

View File

@ -100,15 +100,16 @@ public class TouchCharInput extends androidx.appcompat.widget.AppCompatEditText
* @return if the keyboard is set to be shown.
*/
public boolean switchKeyboardState(){
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
//If an hard keyboard is present, never trigger the soft one
if(hasFocus()
|| (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY
&& getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)){
imm.hideSoftInputFromWindow(getWindowToken(), 0);
clear();
disable();
return false;
}else{
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
enable();
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
return true;