selectAll() selects only visible items.
Whenever selectAll() is called and recyclerview hasn't been scrolled down only visible items are select and count of selected items is also not equal to all items.
private void setUpMultiChoiceRecyclerView() {
MultiChoiceToolbar multiChoiceToolbar =
new MultiChoiceToolbar.Builder(MainActivity.this, appToolbar)
.setTitles(getString(toolbarTitle() ), "")
.build();
folderAdapter.setMultiChoiceToolbar(multiChoiceToolbar);
folderAdapter.setMultiChoiceSelectionListener(new MultiChoiceAdapter.Listener() {
@Override
public void OnItemSelected(int selectedPosition, int itemSelectedCount, int allItemCount) {
bottomBarRecyclerView.setVisibility(View.VISIBLE);
if (itemSelectedCount > 1) {
}
}
@Override
public void OnItemDeselected(int deselectedPosition, int itemSelectedCount, int allItemCount) {
if (itemSelectedCount == 0) {
bottomBarRecyclerView.setVisibility(View.GONE);
}
}
@Override
public void OnSelectAll(int itemSelectedCount, int allItemCount) {
for(int i=0;i<allItemCount;i++){
folderAdapter.select(i);
}
folderAdapter.notifyDataSetChanged();
}
@Override
public void OnDeselectAll(int itemSelectedCount, int allItemCount) {
bottomBarRecyclerView.setVisibility(View.GONE);
}
});
}
I have even tried to select individual elements in callback of onSelectAll(). Thanks.
I've just tried, without scrolling, calling the selectAll() and getSelectedItemCount() method it seems like all the items are selected. Can you please be more specific, add some logs or steps to reproduce. Thanks
I have this problem too.
When ever calling selectAll() only the views already loaded in the the recyclerview is selected, not the whole dataset.
Scrolling down after using selectAll(), new items loaded into the recyclerview from the dataset are not selected.
This happens only when you setup multichoice recyclerview with empty list and add elements to the list later on and notify adapter. If you setup it already populated data list, it works fine.