mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Show FABs on scrolling down
This commit is contained in:
parent
d2144403be
commit
c020266833
1 changed files with 10 additions and 14 deletions
|
@ -694,23 +694,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
rvMessage.addItemDecoration(dateDecorator);
|
rvMessage.addItemDecoration(dateDecorator);
|
||||||
|
|
||||||
rvMessage.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
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
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
if (dy != 0) {
|
if (dy != 0) {
|
||||||
scrolling = true;
|
boolean down = (dy > 0);
|
||||||
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
|
if (scrolling != down) {
|
||||||
fabCompose.hide();
|
scrolling = down;
|
||||||
updateExpanded();
|
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
|
||||||
|
if (dy > 0)
|
||||||
|
fabCompose.hide();
|
||||||
|
else
|
||||||
|
fabCompose.show();
|
||||||
|
updateExpanded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue