1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 19:25:34 +00:00

Show FABs on scrolling down

This commit is contained in:
M66B 2020-07-11 08:34:14 +02:00
parent d2144403be
commit c020266833

View file

@ -694,23 +694,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
rvMessage.addItemDecoration(dateDecorator);
rvMessage.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
scrolling = false;
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
fabCompose.show();
updateExpanded();
}
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy != 0) {
scrolling = true;
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
fabCompose.hide();
updateExpanded();
boolean down = (dy > 0);
if (scrolling != down) {
scrolling = down;
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
if (dy > 0)
fabCompose.hide();
else
fabCompose.show();
updateExpanded();
}
}
}
});