Beispiel #1
0
        /**
         * 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}.
         */
        //@Override

        public override void SetAdapter(IListAdapter adapter)
        {
            IListAdapter wrappedAdapter = adapter;

            mSwipeUndoAdapter = null;

            if (adapter is BaseAdapter)
            {
                BaseAdapter rootAdapter = (BaseAdapter)wrappedAdapter;
                while (rootAdapter is BaseAdapterDecorator)
                {
                    if (rootAdapter is SwipeUndoAdapter)
                    {
                        mSwipeUndoAdapter = (SwipeUndoAdapter)rootAdapter;
                    }
                    rootAdapter = ((BaseAdapterDecorator)rootAdapter).getDecoratedBaseAdapter();
                }

                if (rootAdapter is IInsertable)
                {
                    mAnimateAdditionAdapter = new AnimateAdditionAdapter <object>((BaseAdapter)wrappedAdapter);
                    mAnimateAdditionAdapter.setListView(this);
                    wrappedAdapter = mAnimateAdditionAdapter;
                }
            }

            base.Adapter = wrappedAdapter;

            if (mDragAndDropHandler != null)
            {
                mDragAndDropHandler.setAdapter(adapter);
            }
        }
        /**
         * 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}.
         */
        //@Override

        public override void SetAdapter(IListAdapter adapter)
        {
            IListAdapter wrappedAdapter = adapter;
            mSwipeUndoAdapter = null;

            if (adapter is BaseAdapter)
            {
                BaseAdapter rootAdapter = (BaseAdapter)wrappedAdapter;
                while (rootAdapter is BaseAdapterDecorator)
                {
                    if (rootAdapter is SwipeUndoAdapter)
                    {
                        mSwipeUndoAdapter = (SwipeUndoAdapter)rootAdapter;
                    }
                    rootAdapter = ((BaseAdapterDecorator)rootAdapter).getDecoratedBaseAdapter();
                }

                if (rootAdapter is IInsertable)
                {
                    mAnimateAdditionAdapter = new AnimateAdditionAdapter<object>((BaseAdapter)wrappedAdapter);
                    mAnimateAdditionAdapter.setListView(this);
                    wrappedAdapter = mAnimateAdditionAdapter;
                }
            }

            base.Adapter = wrappedAdapter;

            if (mDragAndDropHandler != null)
            {
                mDragAndDropHandler.setAdapter(adapter);
            }
        }