Search in sources :

Example 1 with FileDateOrderComparator

use of im.actor.sdk.controllers.pickers.file.util.FileDateOrderComparator in project actor-platform by actorapp.

the class ExplorerFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.sortname) {
        list.post(new Runnable() {

            @Override
            public void run() {
                sortdateMenuItem.setVisible(true);
                sortnameMenuItem.setVisible(false);
            }
        });
        removeBack();
        Collections.sort(items, new FileNameOrderComparator());
        insertBack();
        adapter.notifyDataSetChanged();
        return true;
    } else if (id == R.id.sortdate) {
        list.post(new Runnable() {

            @Override
            public void run() {
                sortdateMenuItem.setVisible(false);
                sortnameMenuItem.setVisible(true);
            }
        });
        removeBack();
        Collections.sort(items, new FileDateOrderComparator());
        insertBack();
        adapter.notifyDataSetChanged();
        return true;
    } else if (id == R.id.search) {
        Bundle bundle = new Bundle();
        bundle.putString("root", path);
        SearchFileFragment searchFragment = new SearchFileFragment();
        searchFragment.setArguments(bundle);
        pickerActivity.getFragmentManager().beginTransaction().replace(R.id.container, searchFragment).addToBackStack("search").commit();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bundle(android.os.Bundle) FileNameOrderComparator(im.actor.sdk.controllers.pickers.file.util.FileNameOrderComparator) FileDateOrderComparator(im.actor.sdk.controllers.pickers.file.util.FileDateOrderComparator)

Aggregations

Bundle (android.os.Bundle)1 FileDateOrderComparator (im.actor.sdk.controllers.pickers.file.util.FileDateOrderComparator)1 FileNameOrderComparator (im.actor.sdk.controllers.pickers.file.util.FileNameOrderComparator)1