app/src/main/java/bytecycle/com/miply/MainActivity.java
protected void configureDragListView() {
        // Set Listview backing store (it's an array of views)
        mAdapter = new TaskAdapter(this);
        mListView.setAdapter(mAdapter);

        mListView.setDropListener(new DragSortListView.DropListener() {
            @Override
            public void drop(int from, int to) {
                if (from != to) {
                    TaskItem item = mAdapter.getItem(from);
                    mAdapter.remove(item);
                    mAdapter.insert(item, to);
                }
            }
        });

        mListView.setRemoveListener(new DragSortListView.RemoveListener() {
                                        @Override
                                        public void remove(int which) {
                                            mAdapter.remove(mAdapter.getItem(which));
                                        }
                                    }
        );

        DragSortController controller= new DragSortController(mListView);
        controller.setRemoveEnabled(true);
        controller.setRemoveMode(1);
        controller.setSortEnabled(true);
        controller.setDragInitMode(1);
        mListView.setFloatViewManager(controller);
        mListView.setOnTouchListener(controller);
        mListView.setDragEnabled(true);

        // Icon in the list row that serves as handle for dragging the row
        // defaults to entire row if not set
        controller.setDragHandleId(R.id.draghandle);
        controller.setFlingHandleId(R.id.draghandle);
    }
// DragSortListView requires some extensive configuration to work right..
DragSortListView requires some extensive configuration to work right
DragSortListView requires some extensive configuration to work right
protected void configureDragListView() {
        mAdapter = new TaskAdapter(this);
        mListView.setAdapter(mAdapter);
        mListView.setDropListener(new DragSortListView.DropListener() {
            @Override
            public void drop(int from, int to) {
                if (from != to) {
                    TaskItem item = mAdapter.getItem(from);
                    mAdapter.remove(item);
                    mAdapter.insert(item, to);
                }
            }
        });
        mListView.setRemoveListener(new DragSortListView.RemoveListener() {
                                        @Override
                                        public void remove(int which) {
                                            mAdapter.remove(mAdapter.getItem(which));
                                        }
                                    }
        );
        DragSortController controller= new DragSortController(mListView);
        controller.setRemoveEnabled(true);
        controller.setRemoveMode(1);
        controller.setSortEnabled(true);
        controller.setDragInitMode(1);
        mListView.setFloatViewManager(controller);
        mListView.setOnTouchListener(controller);
        mListView.setDragEnabled(true);
        controller.setDragHandleId(R.id.draghandle);
        controller.setFlingHandleId(R.id.draghandle);
    }
protected void configureDragListView ( ) { mAdapter = new TaskAdapter ( this ) ; mListView . setAdapter ( mAdapter ) ; mListView . setDropListener ( new DragSortListView . DropListener ( ) { @ Override public void drop ( int from , int to ) { if ( from != to ) { TaskItem item = mAdapter . getItem ( from ) ; mAdapter . remove ( item ) ; mAdapter . insert ( item , to ) ; } } } ) ; mListView . setRemoveListener ( new DragSortListView . RemoveListener ( ) { @ Override public void remove ( int which ) { mAdapter . remove ( mAdapter . getItem ( which ) ) ; } } ) ; DragSortController controller = new DragSortController ( mListView ) ; controller . setRemoveEnabled ( true ) ; controller . setRemoveMode ( 1 ) ; controller . setSortEnabled ( true ) ; controller . setDragInitMode ( 1 ) ; mListView . setFloatViewManager ( controller ) ; mListView . setOnTouchListener ( controller ) ; mListView . setDragEnabled ( true ) ; controller . setDragHandleId ( R . id . draghandle ) ; controller . setFlingHandleId ( R . id . draghandle ) ; }
DragSortListView requires some extensive configuration to work right..
DragSortListView requires some extensive configuration to work right ..
// Set Listview backing store (it's an array of views) // Icon in the list row that serves as handle for dragging the row // defaults to entire row if not set