public class RangeSelectorHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
BUNDLE_LAST_LONG_PRESS |
| Constructor and Description |
|---|
RangeSelectorHelper(FastItemAdapter adapter) |
| Modifier and Type | Method and Description |
|---|---|
void |
onClick()
resets the last long pressed index, we only want to respect two consecutive long clicks for selecting a range of items
|
boolean |
onLongClick(int index)
will take care to save the long pressed index
or to select all items in the range between the current long pressed item and the last long pressed item
|
boolean |
onLongClick(int index,
boolean selectItem)
will take care to save the long pressed index
or to select all items in the range between the current long pressed item and the last long pressed item
|
void |
reset()
resets the last long pressed index, we only want to respect two consecutive long presses for selecting a range of items
|
android.os.Bundle |
saveInstanceState(android.os.Bundle savedInstanceState)
add the values to the bundle for saveInstanceState
|
android.os.Bundle |
saveInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix)
add the values to the bundle for saveInstanceState
|
<T extends IItem & IExpandable> |
selectRange(int from,
int to,
boolean select)
selects all items in a range, from and to indizes are inclusive
|
<T extends IItem & IExpandable> |
selectRange(int from,
int to,
boolean select,
boolean skipHeaders)
selects all items in a range, from and to indizes are inclusive
|
RangeSelectorHelper |
withActionModeHelper(ActionModeHelper actionModeHelper)
set the ActionModeHelper, if you want to notify it after a range was selected
so that it can update the ActionMode title
|
RangeSelectorHelper |
withPayload(java.lang.Object payload)
the provided payload will be passed to the adapters notify function, if one is provided
|
RangeSelectorHelper |
withSavedInstanceState(android.os.Bundle savedInstanceState)
restore the index of the last long pressed index
|
RangeSelectorHelper |
withSavedInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix)
restore the index of the last long pressed index
IMPORTANT! Call this method only after all items where added to the adapters again.
|
RangeSelectorHelper |
withSupportSubItems(boolean supportSubItems)
enable this, if you want the range selector to correclty handle sub items as well
|
protected static final java.lang.String BUNDLE_LAST_LONG_PRESS
public RangeSelectorHelper withActionModeHelper(ActionModeHelper actionModeHelper)
actionModeHelper - the action mode helper that should be usedpublic RangeSelectorHelper withSupportSubItems(boolean supportSubItems)
supportSubItems - true, if sub items are supported, false otherwisepublic RangeSelectorHelper withPayload(java.lang.Object payload)
payload - the paylaod that should be passed to the adapter on selection state changepublic void onClick()
public void reset()
public boolean onLongClick(int index)
index - the index of the long pressed itempublic boolean onLongClick(int index,
boolean selectItem)
index - the index of the long pressed itemselectItem - true, if the item at the index should be selected, false if this was already done outside of this helper or is not desiredpublic <T extends IItem & IExpandable> void selectRange(int from,
int to,
boolean select)
from - the from indexto - the to indexselect - true, if the provided range should be selected, false otherwisepublic <T extends IItem & IExpandable> void selectRange(int from,
int to,
boolean select,
boolean skipHeaders)
from - the from indexto - the to indexselect - true, if the provided range should be selected, false otherwiseskipHeaders - true, if you do not want to process headers, false otherwisepublic android.os.Bundle saveInstanceState(android.os.Bundle savedInstanceState)
savedInstanceState - If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Note: Otherwise it is null.public android.os.Bundle saveInstanceState(android.os.Bundle savedInstanceState,
java.lang.String prefix)
savedInstanceState - If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Note: Otherwise it is null.prefix - a prefix added to the savedInstance key so we can store multiple statespublic RangeSelectorHelper withSavedInstanceState(android.os.Bundle savedInstanceState)
savedInstanceState - If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Note: Otherwise it is null.public RangeSelectorHelper withSavedInstanceState(android.os.Bundle savedInstanceState, java.lang.String prefix)
savedInstanceState - If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Note: Otherwise it is null.prefix - a prefix added to the savedInstance key so we can store multiple states