From e600a9772676ebcc581d24f7b82eda282dbef419 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 4 Feb 2021 09:43:37 +0100 Subject: [PATCH] Hide keyboard on recently used folder select --- .../eu/faircode/email/FragmentDialogFolder.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java b/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java index 28b71854e4..e336b66bee 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java @@ -27,6 +27,8 @@ import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.ImageButton; @@ -60,12 +62,12 @@ public class FragmentDialogFolder extends FragmentDialogBase { final long account = getArguments().getLong("account"); final long[] disabled = getArguments().getLongArray("disabled"); - List selected_folders = new ArrayList<>(); - final Context context = getContext(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - String json = prefs.getString("selected_folders", "[]"); + final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + List selected_folders = new ArrayList<>(); + String json = prefs.getString("selected_folders", "[]"); try { JSONArray jarray = new JSONArray(json); for (int i = 0; i < jarray.length(); i++) @@ -168,6 +170,13 @@ public class FragmentDialogFolder extends FragmentDialogBase { } }); + etSearch.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); + } + }); + ibNext.setEnabled(false); ibNext.setOnClickListener(new View.OnClickListener() { @Override