mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-22 06:00:06 +00:00
android: Close soft keyboard on panel close in cheats activity (#6234)
This prevents the keyboard from being stuck in an open state if the user slides the panel while focused on a text box. Now it closes gracefully. Co-authored-by: Charles Lombardo <clombardo169@gmail.com>
This commit is contained in:
parent
b588d6181b
commit
f18437e59f
@ -1,6 +1,8 @@
|
||||
package org.citra.citra_emu.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
@ -32,6 +34,13 @@ public class TwoPaneOnBackPressedCallback extends OnBackPressedCallback
|
||||
|
||||
@Override
|
||||
public void onPanelClosed(@NonNull View panel) {
|
||||
closeKeyboard();
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
private void closeKeyboard() {
|
||||
InputMethodManager manager = (InputMethodManager) mSlidingPaneLayout.getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
manager.hideSoftInputFromWindow(mSlidingPaneLayout.getRootView().getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user