Don't show the FloatingActionMenu when scrolling in search

This commit is contained in:
Jakob Nixdorf 2017-08-06 17:43:53 +02:00
parent 2fb740809b
commit dc0f942c9a
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC

View file

@ -62,6 +62,7 @@ public class MainActivity extends BaseActivity
private EntriesCardAdapter adapter; private EntriesCardAdapter adapter;
private FloatingActionMenu floatingActionMenu; private FloatingActionMenu floatingActionMenu;
private SearchView searchView;
private SimpleItemTouchHelperCallback touchHelperCallback; private SimpleItemTouchHelperCallback touchHelperCallback;
private SharedPreferences sharedPref; private SharedPreferences sharedPref;
@ -204,7 +205,8 @@ public class MainActivity extends BaseActivity
if (dy > 0) { if (dy > 0) {
floatingActionMenu.hide(); floatingActionMenu.hide();
} else { } else {
floatingActionMenu.show(); if (searchView == null || searchView.isIconified())
floatingActionMenu.show();
} }
} }
}); });
@ -318,7 +320,7 @@ public class MainActivity extends BaseActivity
getMenuInflater().inflate(R.menu.menu_main, menu); getMenuInflater().inflate(R.menu.menu_main, menu);
MenuItem searchItem = menu.findItem(R.id.menu_search); MenuItem searchItem = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) searchItem.getActionView(); searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {