Search in sources :

Example 1 with DragSortController

use of com.marshalchen.common.uimodule.dragSortListView.DragSortController in project UltimateAndroid by cymcsg.

the class DSLVFragment method buildController.

/**
     * Called in onCreateView. Override this to provide a custom
     * DragSortController.
     */
public DragSortController buildController(DragSortListView dslv) {
    // defaults are
    //   dragStartMode = onDown
    //   removeMode = flingRight
    DragSortController controller = new DragSortController(dslv);
    controller.setDragHandleId(R.id.drag_handle);
    controller.setClickRemoveId(R.id.click_remove);
    controller.setRemoveEnabled(removeEnabled);
    controller.setSortEnabled(sortEnabled);
    controller.setDragInitMode(dragStartMode);
    controller.setRemoveMode(removeMode);
    return controller;
}
Also used : DragSortController(com.marshalchen.common.uimodule.dragSortListView.DragSortController)

Example 2 with DragSortController

use of com.marshalchen.common.uimodule.dragSortListView.DragSortController in project UltimateAndroid by cymcsg.

the class TestBedDSLV method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    FragmentTransaction transaction;
    DSLVFragment f = (DSLVFragment) getSupportFragmentManager().findFragmentByTag(mTag);
    DragSortListView dslv = (DragSortListView) f.getListView();
    DragSortController control = f.getController();
    switch(item.getItemId()) {
        case R.id.select_remove_mode:
            RemoveModeDialog rdialog = new RemoveModeDialog(mRemoveMode);
            rdialog.setRemoveOkListener(this);
            rdialog.show(getSupportFragmentManager(), "RemoveMode");
            return true;
        case R.id.select_drag_init_mode:
            DragInitModeDialog ddialog = new DragInitModeDialog(mDragStartMode);
            ddialog.setDragOkListener(this);
            ddialog.show(getSupportFragmentManager(), "DragInitMode");
            return true;
        case R.id.select_enables:
            EnablesDialog edialog = new EnablesDialog(mDragEnabled, mSortEnabled, mRemoveEnabled);
            edialog.setEnabledOkListener(this);
            edialog.show(getSupportFragmentManager(), "Enables");
            return true;
        case R.id.add_header:
            mNumHeaders++;
            transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.test_bed, getNewDslvFragment(), mTag);
            transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            transaction.commit();
            return true;
        case R.id.add_footer:
            mNumFooters++;
            transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.test_bed, getNewDslvFragment(), mTag);
            transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            transaction.commit();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) DragSortController(com.marshalchen.common.uimodule.dragSortListView.DragSortController) DragSortListView(com.marshalchen.common.uimodule.dragSortListView.DragSortListView)

Aggregations

DragSortController (com.marshalchen.common.uimodule.dragSortListView.DragSortController)2 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 DragSortListView (com.marshalchen.common.uimodule.dragSortListView.DragSortListView)1