mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01: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;
|
package org.citra.citra_emu.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import androidx.activity.OnBackPressedCallback;
|
import androidx.activity.OnBackPressedCallback;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -32,6 +34,13 @@ public class TwoPaneOnBackPressedCallback extends OnBackPressedCallback
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPanelClosed(@NonNull View panel) {
|
public void onPanelClosed(@NonNull View panel) {
|
||||||
|
closeKeyboard();
|
||||||
setEnabled(false);
|
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