public abstract class SimpleTracker extends java.lang.Object implements FromTracker<java.lang.Integer>, IntoTracker<java.lang.Integer>
FromTracker and IntoTracker assuming that positions will
be used as items ids.
Note, that it will only work correctly if both "from" and "to" lists are the same and there will
be no changes to them which will change existing items' positions. So you can't remove items, or
add items into the middle, but you can add new items to the end of the list, as long as both
lists are updated simultaneously.
If you need to handle more advanced cases you should manually implement FromTracker and
IntoTracker, and use items ids instead of their positions.| Modifier and Type | Field and Description |
|---|---|
static int |
NO_POSITION |
| Constructor and Description |
|---|
SimpleTracker() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Integer |
getIdByPosition(int position) |
int |
getPositionById(java.lang.Integer id) |
protected abstract android.view.View |
getViewAt(int position) |
android.view.View |
getViewById(java.lang.Integer id) |
public static final int NO_POSITION
public java.lang.Integer getIdByPosition(int position)
getIdByPosition in interface IntoTracker<java.lang.Integer>null if position is invalid.
Note, that only one id per position should be possible for "To" view.public int getPositionById(java.lang.Integer id)
NO_POSITION if element with given ID is not part of the list.
public android.view.View getViewById(java.lang.Integer id)
null if view is not found.
null if view is not found on the screen, list view
will be automatically scrolled to needed position (as returned by
getPositionById(Object)) and this method will be called again.protected abstract android.view.View getViewAt(int position)