Fixed collapsing search view

pull/146/head
M66B 6 years ago
parent bcc97c3e08
commit 12ade3a220

@ -100,6 +100,7 @@ public class FragmentMessages extends FragmentEx {
private long primary = -1; private long primary = -1;
private boolean outbox = false; private boolean outbox = false;
private boolean connected = false; private boolean connected = false;
private boolean searching = false;
private AdapterMessage adapter; private AdapterMessage adapter;
private List<Long> archives = new ArrayList<>(); private List<Long> archives = new ArrayList<>();
private List<Long> trashes = new ArrayList<>(); private List<Long> trashes = new ArrayList<>();
@ -866,11 +867,28 @@ public class FragmentMessages extends FragmentEx {
inflater.inflate(R.menu.menu_messages, menu); inflater.inflate(R.menu.menu_messages, menu);
final MenuItem menuSearch = menu.findItem(R.id.menu_search); final MenuItem menuSearch = menu.findItem(R.id.menu_search);
menuSearch.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
searching = true;
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
searching = false;
return true;
}
});
if (searching)
menuSearch.expandActionView();
final SearchView searchView = (SearchView) menuSearch.getActionView(); final SearchView searchView = (SearchView) menuSearch.getActionView();
searchView.setQueryHint(getString(R.string.title_search_hint)); searchView.setQueryHint(getString(R.string.title_search_hint));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
searching = false;
menuSearch.collapseActionView(); menuSearch.collapseActionView();
if (Helper.isPro(getContext())) { if (Helper.isPro(getContext())) {

Loading…
Cancel
Save