mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-31 19:41:19 +00:00
Prevent crash when no focus
This commit is contained in:
parent
d3a235e2d0
commit
4d362165ce
1 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,7 @@ package eu.faircode.email;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
public class FragmentEx extends Fragment {
|
public class FragmentEx extends Fragment {
|
||||||
|
@ -28,7 +29,9 @@ public class FragmentEx extends Fragment {
|
||||||
super.onDetach();
|
super.onDetach();
|
||||||
|
|
||||||
InputMethodManager im = getContext().getSystemService(InputMethodManager.class);
|
InputMethodManager im = getContext().getSystemService(InputMethodManager.class);
|
||||||
im.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
View focussed = getActivity().getCurrentFocus();
|
||||||
|
if (focussed != null)
|
||||||
|
im.hideSoftInputFromWindow(focussed.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSubtitle() {
|
private void updateSubtitle() {
|
||||||
|
|
Loading…
Reference in a new issue