use of com.nhaarman.listviewanimations.util.Swappable in project ListViewAnimations by nhaarman.
the class DragAndDropHandler method setAdapterInternal.
/**
* @throws java.lang.IllegalStateException if the adapter does not have stable ids.
* @throws java.lang.IllegalArgumentException if the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.
*/
private void setAdapterInternal(@NonNull final ListAdapter adapter) {
ListAdapter actualAdapter = adapter;
if (actualAdapter instanceof WrapperListAdapter) {
actualAdapter = ((WrapperListAdapter) actualAdapter).getWrappedAdapter();
}
if (!actualAdapter.hasStableIds()) {
throw new IllegalStateException("Adapter doesn't have stable ids! Make sure your adapter has stable ids, and override hasStableIds() to return true.");
}
if (!(actualAdapter instanceof Swappable)) {
throw new IllegalArgumentException("Adapter should implement Swappable!");
}
mAdapter = actualAdapter;
}
Aggregations