public class SelectExtension<Item extends IItem> extends java.lang.Object implements IAdapterExtension<Item>
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
BUNDLE_SELECTIONS |
| Constructor and Description |
|---|
SelectExtension() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<Item> |
deleteAllSelectedItems()
deletes all current selected items
|
void |
deselect()
deselects all selections
|
void |
deselect(int position)
deselects an item and removes its position in the selections list
|
void |
deselect(int position,
java.util.Iterator<java.lang.Integer> entries)
deselects an item and removes its position in the selections list
also takes an iterator to remove items from the map
|
void |
deselect(Item item)
deselect's a provided item, this won't notify the adapter
|
void |
deselect(Item item,
int position,
java.util.Iterator<java.lang.Integer> entries)
deselects an item and removes its position in the selections list
also takes an iterator to remove items from the map
|
void |
deselect(java.lang.Iterable<java.lang.Integer> positions)
deselects all items at the positions in the iteratable
|
void |
deselectByIdentifier(long identifier)
selects an item by it's identifier
|
void |
deselectByIdentifiers(java.util.Set<java.lang.Long> identifiers) |
void |
deselectByItems(java.util.Set<Item> items) |
java.util.Set<Item> |
getSelectedItems() |
java.util.Set<java.lang.Integer> |
getSelections() |
IAdapterExtension<Item> |
init(FastAdapter<Item> fastAdapter) |
boolean |
isSelectable() |
void |
notifyAdapterDataSetChanged() |
void |
notifyAdapterItemMoved(int fromPosition,
int toPosition) |
void |
notifyAdapterItemRangeChanged(int position,
int itemCount,
java.lang.Object payload) |
void |
notifyAdapterItemRangeInserted(int position,
int itemCount) |
void |
notifyAdapterItemRangeRemoved(int position,
int itemCount) |
boolean |
onClick(android.view.View v,
int pos,
FastAdapter<Item> fastAdapter,
Item item) |
boolean |
onLongClick(android.view.View v,
int pos,
FastAdapter<Item> fastAdapter,
Item item) |
boolean |
onTouch(android.view.View v,
android.view.MotionEvent event,
int position,
FastAdapter<Item> fastAdapter,
Item item) |
void |
performFiltering(java.lang.CharSequence constraint) |
void |
saveInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix) |
void |
select()
select all items
|
void |
select(boolean considerSelectableFlag)
select all items
|
void |
select(IAdapter<Item> adapter,
Item item,
int position,
boolean fireEvent,
boolean considerSelectableFlag)
selects an item and remembers its position in the selections list
|
void |
select(int position)
selects an item and remembers its position in the selections list
|
void |
select(int position,
boolean fireEvent)
selects an item and remembers its position in the selections list
|
void |
select(int position,
boolean fireEvent,
boolean considerSelectableFlag)
selects an item and remembers its position in the selections list
|
void |
select(Item item,
boolean considerSelectableFlag)
select's a provided item, this won't notify the adapter
|
void |
select(java.lang.Iterable<java.lang.Integer> positions)
selects all items at the positions in the iteratable
|
void |
selectByIdentifier(long identifier,
boolean fireEvent,
boolean considerSelectableFlag)
selects an item by it's identifier
|
void |
selectByIdentifiers(java.util.Set<java.lang.Long> identifiers,
boolean fireEvent,
boolean considerSelectableFlag) |
void |
set(java.util.List<Item> items,
boolean resetFilter) |
void |
toggleSelection(int position)
toggles the selection of the item at the given position
|
SelectExtension<Item> |
withAllowDeselection(boolean allowDeselection)
If false, a user can't deselect an item via click (you can still do this programmatically)
|
SelectExtension<Item> |
withMultiSelect(boolean multiSelect)
Enable this if you want multiSelection possible in the list
|
void |
withSavedInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix) |
SelectExtension<Item> |
withSelectable(boolean selectable)
set if no item is selectable
|
SelectExtension<Item> |
withSelectionListener(ISelectionListener<Item> selectionListener)
set a listener that get's notified whenever an item is selected or deselected
|
SelectExtension<Item> |
withSelectOnLongClick(boolean selectOnLongClick)
Disable this if you want the selection on a single tap
|
SelectExtension<Item> |
withSelectWithItemUpdate(boolean selectWithItemUpdate)
select between the different selection behaviors.
|
protected static final java.lang.String BUNDLE_SELECTIONS
public SelectExtension<Item> withSelectWithItemUpdate(boolean selectWithItemUpdate)
selectWithItemUpdate - true if notifyItemChanged should be called upon selectpublic SelectExtension<Item> withMultiSelect(boolean multiSelect)
multiSelect - true to enable multiSelectpublic SelectExtension<Item> withSelectOnLongClick(boolean selectOnLongClick)
selectOnLongClick - false to do select via single clickpublic SelectExtension<Item> withAllowDeselection(boolean allowDeselection)
allowDeselection - true if a user can deselect an already selected item via clickpublic SelectExtension<Item> withSelectable(boolean selectable)
selectable - true if items are selectablepublic boolean isSelectable()
public SelectExtension<Item> withSelectionListener(ISelectionListener<Item> selectionListener)
selectionListener - the listener that will be notified about selection changespublic IAdapterExtension<Item> init(FastAdapter<Item> fastAdapter)
init in interface IAdapterExtension<Item extends IItem>public void withSavedInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix)
withSavedInstanceState in interface IAdapterExtension<Item extends IItem>public void saveInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix)
saveInstanceState in interface IAdapterExtension<Item extends IItem>public boolean onClick(android.view.View v,
int pos,
FastAdapter<Item> fastAdapter,
Item item)
onClick in interface IAdapterExtension<Item extends IItem>public boolean onLongClick(android.view.View v,
int pos,
FastAdapter<Item> fastAdapter,
Item item)
onLongClick in interface IAdapterExtension<Item extends IItem>public boolean onTouch(android.view.View v,
android.view.MotionEvent event,
int position,
FastAdapter<Item> fastAdapter,
Item item)
onTouch in interface IAdapterExtension<Item extends IItem>public void notifyAdapterDataSetChanged()
notifyAdapterDataSetChanged in interface IAdapterExtension<Item extends IItem>public void notifyAdapterItemRangeInserted(int position,
int itemCount)
notifyAdapterItemRangeInserted in interface IAdapterExtension<Item extends IItem>public void notifyAdapterItemRangeRemoved(int position,
int itemCount)
notifyAdapterItemRangeRemoved in interface IAdapterExtension<Item extends IItem>public void notifyAdapterItemMoved(int fromPosition,
int toPosition)
notifyAdapterItemMoved in interface IAdapterExtension<Item extends IItem>public void notifyAdapterItemRangeChanged(int position,
int itemCount,
java.lang.Object payload)
notifyAdapterItemRangeChanged in interface IAdapterExtension<Item extends IItem>public void set(java.util.List<Item> items, boolean resetFilter)
set in interface IAdapterExtension<Item extends IItem>public void performFiltering(java.lang.CharSequence constraint)
performFiltering in interface IAdapterExtension<Item extends IItem>public java.util.Set<java.lang.Integer> getSelections()
public java.util.Set<Item> getSelectedItems()
public void toggleSelection(int position)
position - the global positionpublic void select()
public void select(boolean considerSelectableFlag)
considerSelectableFlag - true if the select method should not select an item if its not selectablepublic void select(Item item, boolean considerSelectableFlag)
item - the item to selectconsiderSelectableFlag - true if the select method should not select an item if its not selectablepublic void select(java.lang.Iterable<java.lang.Integer> positions)
positions - the global positions to selectpublic void select(int position)
position - the global positionpublic void select(int position,
boolean fireEvent)
position - the global positionfireEvent - true if the onClick listener should be calledpublic void select(int position,
boolean fireEvent,
boolean considerSelectableFlag)
position - the global positionfireEvent - true if the onClick listener should be calledconsiderSelectableFlag - true if the select method should not select an item if its not selectablepublic void select(IAdapter<Item> adapter, Item item, int position, boolean fireEvent, boolean considerSelectableFlag)
adapter - adapter holding this item (or it's parent)item - the item to selectposition - the global position (or < 0 if the item is not displayed)fireEvent - true if the onClick listener should be calledconsiderSelectableFlag - true if the select method should not select an item if its not selectablepublic void selectByIdentifier(long identifier,
boolean fireEvent,
boolean considerSelectableFlag)
identifier - the identifier of the item to selectfireEvent - true if the onClick listener should be calledconsiderSelectableFlag - true if the select method should not select an item if its not selectablepublic void selectByIdentifiers(java.util.Set<java.lang.Long> identifiers,
boolean fireEvent,
boolean considerSelectableFlag)
identifiers - the set of identifiers to selectfireEvent - true if the onClick listener should be calledconsiderSelectableFlag - true if the select method should not select an item if its not selectablepublic void deselect()
public void deselect(Item item)
item - the item to selectpublic void deselect(java.lang.Iterable<java.lang.Integer> positions)
positions - the global positions to deselectpublic void deselect(int position)
position - the global positionpublic void deselect(int position,
java.util.Iterator<java.lang.Integer> entries)
position - the global positionentries - the iterator which is used to deselect allpublic void deselect(Item item, int position, java.util.Iterator<java.lang.Integer> entries)
item - the item to deselectedposition - the global position (or < 0 if the item is not displayed)entries - the iterator which is used to deselect allpublic void deselectByIdentifier(long identifier)
identifier - the identifier of the item to deselectpublic void deselectByIdentifiers(java.util.Set<java.lang.Long> identifiers)
identifiers - the set of identifiers to deselectpublic void deselectByItems(java.util.Set<Item> items)
items - the set of items to deselect. They require a identifier.public java.util.List<Item> deleteAllSelectedItems()