mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Put focus in search field and show keyboard automatically
This commit is contained in:
parent
d1294ca584
commit
2670c2642a
1 changed files with 16 additions and 1 deletions
|
@ -30,6 +30,7 @@ import android.support.v4.app.Fragment;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SearchView;
|
||||
|
||||
|
@ -123,7 +124,7 @@ public class SearchFragment extends Fragment implements ShareUserListAdapter.Sha
|
|||
public boolean onQueryTextSubmit(String query) {
|
||||
Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query);
|
||||
return true; // return true to prevent the query is processed to be queried;
|
||||
// a user / group will be picked only if selected in the list of suggestions
|
||||
// a user / group will be picked only if selected in the list of suggestions
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,6 +185,20 @@ public class SearchFragment extends Fragment implements ShareUserListAdapter.Sha
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// focus the search view and request the software keyboard be shown
|
||||
View searchView = getView().findViewById(R.id.searchView);
|
||||
if (searchView.requestFocus()) {
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.showSoftInput(searchView.findFocus(), InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
|
|
Loading…
Reference in a new issue