public final class MultiSelectManager extends Object
Modifier and Type | Class and Description |
---|---|
class |
MultiSelectManager.BandController
Provides mouse driven band-select support when used in conjunction with
RecyclerView
and MultiSelectManager . |
static interface |
MultiSelectManager.Callback |
static class |
MultiSelectManager.GridModel
Provides a band selection item model for views within a RecyclerView.
|
static class |
MultiSelectManager.Selection
Object representing the current selection.
|
static interface |
MultiSelectManager.SelectionMode |
Modifier and Type | Field and Description |
---|---|
static int |
MODE_MULTIPLE |
static int |
MODE_SINGLE |
Constructor and Description |
---|
MultiSelectManager(RecyclerView recyclerView,
com.android.documentsui.dirlist.DocumentsAdapter adapter,
int mode,
MultiSelectManager.Selection initialSelection) |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(MultiSelectManager.Callback callback)
Adds
callback such that it will be notified when MultiSelectManager
events occur. |
void |
clearSelection()
Clears the selection and notifies (even if nothing changes).
|
MultiSelectManager.Selection |
getSelection()
Returns a Selection object that provides a live view
on the current selection.
|
MultiSelectManager.Selection |
getSelection(MultiSelectManager.Selection dest)
Updates
dest to reflect the current selection. |
void |
handleLayoutChanged() |
boolean |
hasSelection() |
boolean |
setItemsSelected(Iterable<String> ids,
boolean selected)
Sets the selected state of the specified items.
|
void |
toggleSelection(String modelId)
Toggles selection on the item with the given model ID.
|
void |
updateSelection(MultiSelectManager.Selection selection)
Updates selection to include items in
selection . |
public static final int MODE_MULTIPLE
public static final int MODE_SINGLE
public MultiSelectManager(RecyclerView recyclerView, com.android.documentsui.dirlist.DocumentsAdapter adapter, int mode, @Nullable MultiSelectManager.Selection initialSelection)
mode
- Selection single or multiple selection mode.initialSelection
- selection state probably preserved in external state.public void addCallback(MultiSelectManager.Callback callback)
callback
such that it will be notified when MultiSelectManager
events occur.callback
- public boolean hasSelection()
public MultiSelectManager.Selection getSelection()
on how to get a snapshot
of the selection that will not reflect future changes
to selection.
public MultiSelectManager.Selection getSelection(MultiSelectManager.Selection dest)
dest
to reflect the current selection.dest
- public void updateSelection(MultiSelectManager.Selection selection)
selection
.public boolean setItemsSelected(Iterable<String> ids, boolean selected)
ids
- selected
- public void clearSelection()
public void handleLayoutChanged()
public void toggleSelection(String modelId)
modelId
-