[app] Better fab scroll behavior

This commit is contained in:
LoveSy 2021-11-22 19:05:14 +08:00 committed by GitHub
parent 6d098e9ba8
commit 237a746762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 12 deletions

View File

@ -352,18 +352,6 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
binding.recyclerView.setAdapter(fragment.adapters.get(position));
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(requireActivity());
binding.recyclerView.setLayoutManager(layoutManager);
if (users != null && users.size() != 1) {
binding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
fragment.binding.fab.show();
} else {
fragment.binding.fab.hide();
}
}
});
}
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
return binding.getRoot();
}

View File

@ -83,5 +83,6 @@
android:contentDescription="@string/add_module_to_user"
android:src="@drawable/ic_baseline_add_24"
android:visibility="gone"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
app:layout_fitsSystemWindowsInsets="bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>