6.3.2.4.3. ListSelectorAdapter

public abstract class ListSelectorAdapter extends RecyclerView.Adapter<ListSelectorAdapter.ViewHolder>

6.3.2.4.3.1. Fields

6.3.2.4.3.1.1. mCurrentSingleSelected

protected int mCurrentSingleSelected

6.3.2.4.3.1.2. mHideCheckBox

protected boolean mHideCheckBox

6.3.2.4.3.1.3. mOnItemClickListener

protected ListSelectorAdapter.ViewHolder.OnItemClickListener mOnItemClickListener

6.3.2.4.3.1.4. mOnItemLongClickListener

protected ListSelectorAdapter.ViewHolder.OnItemLongClickListener mOnItemLongClickListener

6.3.2.4.3.1.5. mOnSelectionChangedListeners

protected Queue<OnSelectionChangedListener> mOnSelectionChangedListeners

6.3.2.4.3.1.6. mSelectState

protected boolean mSelectState

6.3.2.4.3.1.7. mSelectedItems

protected SparseBooleanArray mSelectedItems

6.3.2.4.3.1.8. mSingleSelectable

protected boolean mSingleSelectable

6.3.2.4.3.2. Constructors

6.3.2.4.3.2.1. ListSelectorAdapter

public ListSelectorAdapter()

6.3.2.4.3.3. Methods

6.3.2.4.3.3.1. addOnSelectionChangedListener

public void addOnSelectionChangedListener(OnSelectionChangedListener listener)

6.3.2.4.3.3.2. clearSelectionForAll

public void clearSelectionForAll()

Clear the selection status for all items

6.3.2.4.3.3.3. deleteAllSelected

public void deleteAllSelected()

6.3.2.4.3.3.4. deleteSelected

protected void deleteSelected(int id)

6.3.2.4.3.3.5. getCurrentSingleSelectedItemId

public Integer getCurrentSingleSelectedItemId()

6.3.2.4.3.3.6. getItemViewResId

protected abstract int getItemViewResId()

6.3.2.4.3.3.7. getSelectedItemCount

public int getSelectedItemCount()

Count the selected items

Returns:Selected items count

6.3.2.4.3.3.8. getSelectedItemsIds

public List<Integer> getSelectedItemsIds()

Indicates the list of selected items

Returns:List of selected items ids

6.3.2.4.3.3.9. getViewHolder

protected abstract ListSelectorAdapter.ViewHolder getViewHolder(View itemView)

6.3.2.4.3.3.10. hasSelectedItems

public boolean hasSelectedItems()

6.3.2.4.3.3.11. isSelected

public boolean isSelected(int position)

Indicates if the item at position position is selected

Parameters:
  • position – Position of the item to check
Returns:

true if the item is selected, false otherwise

6.3.2.4.3.3.12. isSingleSelectable

public boolean isSingleSelectable()

6.3.2.4.3.3.13. onBindViewHolder

public void onBindViewHolder(ViewHolder holder, int position)

6.3.2.4.3.3.14. onCreateViewHolder

public final ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

6.3.2.4.3.3.15. onViewRecycled

public void onViewRecycled(ViewHolder holder)

6.3.2.4.3.3.16. removeOnSelectionChangedListener

public void removeOnSelectionChangedListener(OnSelectionChangedListener listener)

6.3.2.4.3.3.17. setOnItemClickListener

public void setOnItemClickListener(ListSelectorAdapter.ViewHolder.OnItemClickListener listener)

6.3.2.4.3.3.18. setOnItemLongClickListener

public void setOnItemLongClickListener(ListSelectorAdapter.ViewHolder.OnItemLongClickListener listener)

6.3.2.4.3.3.19. setSelection

public void setSelection(int position, boolean selection)

Set the selection status of the item at a given position to the given state

Parameters:
  • position – Position of the item to toggle the selection status for
  • selection – State for the item at position

6.3.2.4.3.3.20. setSelectionForAll

public void setSelectionForAll(boolean selection)

6.3.2.4.3.3.21. setSingleSelectable

public void setSingleSelectable(boolean singleSelectable)

6.3.2.4.3.3.22. toggleSelection

public void toggleSelection(int position)

Toggle the selection status of the item at a given position

Parameters:
  • position – Position of the item to toggle the selection status for

6.3.2.4.3.3.23. toggleSelectionForAll

public void toggleSelectionForAll()