// Path: lib-core/src/main/java/com/nhaarman/listviewanimations/ArrayAdapter.java
// @SuppressWarnings("UnusedDeclaration")
// public abstract class ArrayAdapter<T> extends BaseAdapter implements Swappable, Insertable<T> {
// 
//     @NonNull
//     private final List<T> mItems;
// 
//     private BaseAdapter mDataSetChangedSlavedAdapter;
// 
//     /**
//      * Creates a new ArrayAdapter with an empty {@code List}.
//      */
//     protected ArrayAdapter() {
//         this(null);
//     }
// 
//     /**
//      * Creates a new ArrayAdapter, using (a copy of) given {@code List}, or an empty {@code List} if objects = null.
//      */
//     protected ArrayAdapter(@Nullable final List<T> objects) {
//         if (objects != null) {
//             mItems = objects;
//         } else {
//             mItems = new ArrayList<>();
//         }
//     }
// 
//     @Override
//     public int getCount() {
//         return mItems.size();
//     }
// 
//     @Override
//     public long getItemId(final int position) {
//         return position;
//     }
// 
//     @Override
//     @NonNull
//     public T getItem(final int position) {
//         return mItems.get(position);
//     }
// 
//     /**
//      * Returns the items.
//      */
//     @NonNull
//     public List<T> getItems() {
//         return mItems;
//     }
// 
//     /**
//      * Appends the specified element to the end of the {@code List}.
//      *
//      * @param object the object to add.
//      *
//      * @return always true.
//      */
//     public boolean add(@NonNull final T object) {
//         boolean result = mItems.add(object);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @Override
//     public void add(final int index, @NonNull final T item) {
//         mItems.add(index, item);
//         notifyDataSetChanged();
//     }
// 
//     /**
//      * Adds the objects in the specified collection to the end of this List. The objects are added in the order in which they are returned from the collection's iterator.
//      *
//      * @param collection the collection of objects.
//      *
//      * @return {@code true} if this {@code List} is modified, {@code false} otherwise.
//      */
//     public boolean addAll(@NonNull final Collection<? extends T> collection) {
//         boolean result = mItems.addAll(collection);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     public boolean contains(final T object) {
//         return mItems.contains(object);
//     }
// 
//     public void clear() {
//         mItems.clear();
//         notifyDataSetChanged();
//     }
// 
//     public boolean remove(@NonNull final Object object) {
//         boolean result = mItems.remove(object);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @NonNull
//     public T remove(final int location) {
//         T result = mItems.remove(location);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @Override
//     public void swapItems(final int positionOne, final int positionTwo) {
//         T firstItem = mItems.set(positionOne, getItem(positionTwo));
//         notifyDataSetChanged();
//         mItems.set(positionTwo, firstItem);
//     }
// 
//     public void propagateNotifyDataSetChanged(@NonNull final BaseAdapter slavedAdapter) {
//         mDataSetChangedSlavedAdapter = slavedAdapter;
//     }
// 
//     @Override
//     public void notifyDataSetChanged() {
//         super.notifyDataSetChanged();
//         if (mDataSetChangedSlavedAdapter != null) {
//             mDataSetChangedSlavedAdapter.notifyDataSetChanged();
//         }
//     }
// }


import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.nhaarman.listviewanimations.ArrayAdapter;
import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;
        for (int i = 0; i < 20; i++) {
            integers.add(i);
        }

        ListAdapter myListAdapter = new MyListAdapter(this, integers);
        mListView.setAdapter(myListAdapter);

        setContentView(mListView);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        int[] location = new int[2];
        mListView.getLocationOnScreen(location);

        ev = MotionEvent.obtain(ev.getDownTime(), ev.getEventTime(), ev.getAction(), ev.getX() - location[0], ev.getY() - location[1], ev.getMetaState());
        boolean handled = mListView.onInterceptTouchEvent(ev);
        if (!handled) {
            handled = mListView.dispatchTouchEvent(ev);
        }
        if (!handled) {
            handled = onTouchEvent(ev);
        }
        return handled;
    }

    public DynamicListView getDynamicListView() {
        return mListView;
    }

// Path: lib-core/src/main/java/com/nhaarman/listviewanimations/ArrayAdapter.java
// @SuppressWarnings("UnusedDeclaration")
// public abstract class ArrayAdapter<T> extends BaseAdapter implements Swappable, Insertable<T> {
// 
//     @NonNull
//     private final List<T> mItems;
// 
//     private BaseAdapter mDataSetChangedSlavedAdapter;
// 
//     /**
//      * Creates a new ArrayAdapter with an empty {@code List}.
//      */
//     protected ArrayAdapter() {
//         this(null);
//     }
// 
//     /**
//      * Creates a new ArrayAdapter, using (a copy of) given {@code List}, or an empty {@code List} if objects = null.
//      */
//     protected ArrayAdapter(@Nullable final List<T> objects) {
//         if (objects != null) {
//             mItems = objects;
//         } else {
//             mItems = new ArrayList<>();
//         }
//     }
// 
//     @Override
//     public int getCount() {
//         return mItems.size();
//     }
// 
//     @Override
//     public long getItemId(final int position) {
//         return position;
//     }
// 
//     @Override
//     @NonNull
//     public T getItem(final int position) {
//         return mItems.get(position);
//     }
// 
//     /**
//      * Returns the items.
//      */
//     @NonNull
//     public List<T> getItems() {
//         return mItems;
//     }
// 
//     /**
//      * Appends the specified element to the end of the {@code List}.
//      *
//      * @param object the object to add.
//      *
//      * @return always true.
//      */
//     public boolean add(@NonNull final T object) {
//         boolean result = mItems.add(object);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @Override
//     public void add(final int index, @NonNull final T item) {
//         mItems.add(index, item);
//         notifyDataSetChanged();
//     }
// 
//     /**
//      * Adds the objects in the specified collection to the end of this List. The objects are added in the order in which they are returned from the collection's iterator.
//      *
//      * @param collection the collection of objects.
//      *
//      * @return {@code true} if this {@code List} is modified, {@code false} otherwise.
//      */
//     public boolean addAll(@NonNull final Collection<? extends T> collection) {
//         boolean result = mItems.addAll(collection);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     public boolean contains(final T object) {
//         return mItems.contains(object);
//     }
// 
//     public void clear() {
//         mItems.clear();
//         notifyDataSetChanged();
//     }
// 
//     public boolean remove(@NonNull final Object object) {
//         boolean result = mItems.remove(object);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @NonNull
//     public T remove(final int location) {
//         T result = mItems.remove(location);
//         notifyDataSetChanged();
//         return result;
//     }
// 
//     @Override
//     public void swapItems(final int positionOne, final int positionTwo) {
//         T firstItem = mItems.set(positionOne, getItem(positionTwo));
//         notifyDataSetChanged();
//         mItems.set(positionTwo, firstItem);
//     }
// 
//     public void propagateNotifyDataSetChanged(@NonNull final BaseAdapter slavedAdapter) {
//         mDataSetChangedSlavedAdapter = slavedAdapter;
//     }
// 
//     @Override
//     public void notifyDataSetChanged() {
//         super.notifyDataSetChanged();
//         if (mDataSetChangedSlavedAdapter != null) {
//             mDataSetChangedSlavedAdapter.notifyDataSetChanged();
//         }
//     }
// }


// Path: lib-manipulation/src/androidTest/java/com/nhaarman/listviewanimations/itemmanipulation/dragdrop/DynamicListViewTestActivity.java
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.nhaarman.listviewanimations.ArrayAdapter;
import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;

        for (int i = 0; i < 20; i++) {
            integers.add(i);
        }

        ListAdapter myListAdapter = new MyListAdapter(this, integers);
        mListView.setAdapter(myListAdapter);

        setContentView(mListView);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        int[] location = new int[2];
        mListView.getLocationOnScreen(location);

        ev = MotionEvent.obtain(ev.getDownTime(), ev.getEventTime(), ev.getAction(), ev.getX() - location[0], ev.getY() - location[1], ev.getMetaState());
        boolean handled = mListView.onInterceptTouchEvent(ev);
        if (!handled) {
            handled = mListView.dispatchTouchEvent(ev);
        }
        if (!handled) {
            handled = onTouchEvent(ev);
        }
        return handled;
    }

    public DynamicListView getDynamicListView() {
        return mListView;
    }

    private static class MyListAdapter extends ArrayAdapter<Integer> {