public class ItemFilter<Model,Item extends IItem>
extends android.widget.Filter
| Modifier and Type | Field and Description |
|---|---|
protected ItemFilterListener<Item> |
mItemFilterListener |
| Constructor and Description |
|---|
ItemFilter(ModelAdapter<?,Item> itemAdapter) |
| Modifier and Type | Method and Description |
|---|---|
ModelAdapter<?,Item> |
add(int position,
Item... items)
add an array of items at the given position within the existing items
|
ModelAdapter<?,Item> |
add(int position,
java.util.List<Item> items)
add a list of items at the given position within the existing items
|
ModelAdapter<?,Item> |
add(Item... items)
add an array of items to the end of the existing items
|
ModelAdapter<?,Item> |
add(java.util.List<Item> items)
add a list of items to the end of the existing items
will prior check if we are currently filtering
|
ModelAdapter<?,Item> |
clear()
removes all items of this adapter
|
int |
getAdapterPosition(Item item)
Searches for the given item and calculates its relative position
|
int |
getAdapterPosition(long identifier)
Searches for the given identifier and calculates its relative position
|
java.lang.CharSequence |
getConstraint() |
java.util.Set<Item> |
getSelectedItems()
helper method to get all selections from the ItemAdapter's original item list
|
java.util.Set<java.lang.Integer> |
getSelections()
helper method to get all selections from the ItemAdapter's original item list
|
ModelAdapter<?,Item> |
move(int fromPosition,
int toPosition)
moves an item within the list from a position to a position
|
android.widget.Filter.FilterResults |
performFiltering(java.lang.CharSequence constraint) |
protected void |
publishResults(java.lang.CharSequence constraint,
android.widget.Filter.FilterResults results) |
ModelAdapter<?,Item> |
remove(int position)
removes an item at the given position within the existing icons
|
ModelAdapter<?,Item> |
removeRange(int position,
int itemCount)
removes a range of items starting with the given position within the existing icons
|
ModelAdapter<?,Item> |
set(int position,
Item item)
sets an item at the given position, overwriting the previous item
|
ItemFilter<Model,Item> |
withFilterPredicate(IItemAdapter.Predicate<Item> filterPredicate)
define the predicate used to filter the list inside the ItemFilter
|
ItemFilter<Model,Item> |
withItemFilterListener(ItemFilterListener<Item> listener) |
protected ItemFilterListener<Item extends IItem> mItemFilterListener
public ItemFilter(ModelAdapter<?,Item> itemAdapter)
public ItemFilter<Model,Item> withItemFilterListener(ItemFilterListener<Item> listener)
listener - which will be called after the items were filteredpublic ItemFilter<Model,Item> withFilterPredicate(IItemAdapter.Predicate<Item> filterPredicate)
filterPredicate - the predicate used to filter the list inside the ItemFilterpublic android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence constraint)
performFiltering in class android.widget.Filterpublic java.lang.CharSequence getConstraint()
protected void publishResults(java.lang.CharSequence constraint,
android.widget.Filter.FilterResults results)
publishResults in class android.widget.Filterpublic java.util.Set<java.lang.Integer> getSelections()
public java.util.Set<Item> getSelectedItems()
public int getAdapterPosition(Item item)
item - the item which is searched forpublic int getAdapterPosition(long identifier)
identifier - the identifier of an item which is searched for@SafeVarargs public final ModelAdapter<?,Item> add(Item... items)
items - the items to addpublic ModelAdapter<?,Item> add(java.util.List<Item> items)
items - the items to add@SafeVarargs public final ModelAdapter<?,Item> add(int position, Item... items)
position - the global positionitems - the items to addpublic ModelAdapter<?,Item> add(int position, java.util.List<Item> items)
position - the global positionitems - the items to addpublic ModelAdapter<?,Item> set(int position, Item item)
position - the global positionitem - the item to setpublic ModelAdapter<?,Item> move(int fromPosition, int toPosition)
fromPosition - the position global from which we want to movetoPosition - the global position to which to movepublic ModelAdapter<?,Item> remove(int position)
position - the global positionpublic ModelAdapter<?,Item> removeRange(int position, int itemCount)
position - the global positionitemCount - the count of items which were removedpublic ModelAdapter<?,Item> clear()