-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
Behavior similar to #5, the handle is shown when the adapter implements Filterable and the search filter returns an empty dataset.
As a bonus, this caused my app to crash when touching the handle in that situation, because my implementation of the getSectionText() method, calling .get() on an empty list, threw an ArrayIndexOutOfBoundsException.
I fixed implementing the following code in my class, but in my opinion this should be managed by the Fastscroller itself:
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
MyClassBinding binding = MyClassBinding.inflate(getLayoutInflater());
FastScrollRecyclerView recyclerView = binding.recyclerView;
[... myAdapter initialization ...]
myAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override public void onChanged() {
super.onChanged();
recyclerView.setFastScrollEnabled(myAdapter.getItemCount() != 0);
}
});
[...]
return binding.getRoot();
}
Metadata
Metadata
Assignees
Labels
No labels