mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Small improvement
This commit is contained in:
parent
19938e764d
commit
556fae1bdb
1 changed files with 8 additions and 4 deletions
|
@ -50,6 +50,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentResultListener;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
@ -322,10 +323,13 @@ public class FragmentBase extends Fragment {
|
|||
super.onDetach();
|
||||
|
||||
try {
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View focused = getActivity().getCurrentFocus();
|
||||
if (imm != null && focused != null)
|
||||
imm.hideSoftInputFromWindow(focused.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View focused = activity.getCurrentFocus();
|
||||
if (imm != null && focused != null)
|
||||
imm.hideSoftInputFromWindow(focused.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue