Search in sources :

Example 6 with DragSortListView

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

the class Sections method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.drag_sort_listview_sections_main);
    DragSortListView dslv = (DragSortListView) getListView();
    // get jazz artist names and make adapter
    String[] array = getResources().getStringArray(R.array.jazz_artist_names);
    List<String> list = new ArrayList<String>(Arrays.asList(array));
    SectionAdapter adapter = new SectionAdapter(this, list);
    dslv.setDropListener(adapter);
    // make and set controller on dslv
    SectionController c = new SectionController(dslv, adapter);
    dslv.setFloatViewManager(c);
    dslv.setOnTouchListener(c);
    // pass it to the ListActivity
    setListAdapter(adapter);
}
Also used : ArrayList(java.util.ArrayList) DragSortListView(com.marshalchen.common.uimodule.dragSortListView.DragSortListView)

Example 7 with DragSortListView

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

the class SingleChoiceListView method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.drag_sort_listview_checkable_main);
    String[] array = getResources().getStringArray(R.array.jazz_artist_names);
    ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList(array));
    adapter = new ArrayAdapter<String>(this, R.layout.drag_sort_listview_list_item_radio, R.id.text, arrayList);
    setListAdapter(adapter);
    DragSortListView list = getListView();
    list.setDropListener(onDrop);
    list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
Also used : ArrayList(java.util.ArrayList) DragSortListView(com.marshalchen.common.uimodule.dragSortListView.DragSortListView)

Example 8 with DragSortListView

use of com.marshalchen.common.uimodule.dragSortListView.DragSortListView 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

DragSortListView (com.marshalchen.common.uimodule.dragSortListView.DragSortListView)8 ArrayList (java.util.ArrayList)3 MatrixCursor (android.database.MatrixCursor)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 DragSortController (com.marshalchen.common.uimodule.dragSortListView.DragSortController)1