code: @Override
      public void setAdapter(final ListAdapter adapter) {
          ListAdapter wrappedAdapter = adapter;
          mSwipeUndoAdapter = null;
  
          if (adapter instanceof BaseAdapter) {
              BaseAdapter rootAdapter = (BaseAdapter) wrappedAdapter;
              while (rootAdapter instanceof BaseAdapterDecorator) {
                  if (rootAdapter instanceof SwipeUndoAdapter) {
                      mSwipeUndoAdapter = (SwipeUndoAdapter) rootAdapter;
                  }
                  rootAdapter = ((BaseAdapterDecorator) rootAdapter).getDecoratedBaseAdapter();
              }
  
              if (rootAdapter instanceof Insertable) {
                  mAnimateAdditionAdapter = new AnimateAdditionAdapter((BaseAdapter) wrappedAdapter);
                  mAnimateAdditionAdapter.setListView(this);
                  wrappedAdapter = mAnimateAdditionAdapter;
              }
          }
  
          super.setAdapter(wrappedAdapter);
  
          if (mDragAndDropHandler != null) {
              mDragAndDropHandler.setAdapter(adapter);
          }
      }
docs: Sets the {@link ListAdapter} for this {@code DynamicListView}.
  If the drag and drop functionality is or will be enabled, the adapter should have stable ids,
  and should implement {@link com.nhaarman.listviewanimations.util.Swappable}.
  
  @param adapter the adapter.
  
  @throws java.lang.IllegalStateException    if the drag and drop functionality is enabled
  and the adapter does not have stable ids.
  @throws java.lang.IllegalArgumentException if the drag and drop functionality is enabled
  and the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.