Hide the FloatingActionMenu on scroll

Fixes #8
This commit is contained in:
Jakob Nixdorf 2017-07-27 22:20:44 +02:00
parent f8f7ed8411
commit 8ff4cac725
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
2 changed files with 14 additions and 0 deletions

View file

@ -6,6 +6,7 @@
* New feature: show a warning about backups on the first launch
* Style/UI: rename Export and Import to Backup and Restore
* Bug fix: don't require device authentication again after screen rotation (Issue #7)
* Bug fix: hide the FloatingActionMenu on scroll (Issue #8)
* Bug fix: rename the apps launcher icon to "andOTP" (Issue #6)
* Code: lots of internal refactoring

View file

@ -192,6 +192,19 @@ public class MainActivity extends AppCompatActivity {
adapter = new EntriesCardAdapter(this);
recList.setAdapter(adapter);
recList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0) {
floatingActionMenu.hide();
} else {
floatingActionMenu.show();
}
}
});
touchHelperCallback = new SimpleItemTouchHelperCallback(adapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(touchHelperCallback);
touchHelper.attachToRecyclerView(recList);