Hide keyboard on recently used folder select

This commit is contained in:
M66B 2021-02-04 09:43:37 +01:00
parent 8283253708
commit e600a97726
1 changed files with 12 additions and 3 deletions

View File

@ -27,6 +27,8 @@ import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -60,12 +62,12 @@ public class FragmentDialogFolder extends FragmentDialogBase {
final long account = getArguments().getLong("account"); final long account = getArguments().getLong("account");
final long[] disabled = getArguments().getLongArray("disabled"); final long[] disabled = getArguments().getLongArray("disabled");
List<String> selected_folders = new ArrayList<>();
final Context context = getContext(); final Context context = getContext();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String json = prefs.getString("selected_folders", "[]"); final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
List<String> selected_folders = new ArrayList<>();
String json = prefs.getString("selected_folders", "[]");
try { try {
JSONArray jarray = new JSONArray(json); JSONArray jarray = new JSONArray(json);
for (int i = 0; i < jarray.length(); i++) 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.setEnabled(false);
ibNext.setOnClickListener(new View.OnClickListener() { ibNext.setOnClickListener(new View.OnClickListener() {
@Override @Override