From 4423afd462da19b48ca597fff69f79b3ac2cd3a5 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 20 Dec 2022 17:06:21 -0500 Subject: [PATCH] Android: Close soft keyboard on panel close --- .../dolphinemu/ui/TwoPaneOnBackPressedCallback.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/TwoPaneOnBackPressedCallback.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/TwoPaneOnBackPressedCallback.java index a6a0da5f97..0ab829fa77 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/TwoPaneOnBackPressedCallback.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/TwoPaneOnBackPressedCallback.java @@ -2,7 +2,9 @@ package org.dolphinemu.dolphinemu.ui; +import android.content.Context; import android.view.View; +import android.view.inputmethod.InputMethodManager; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; @@ -40,7 +42,15 @@ 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); + } }