Search in sources :

Example 6 with DocumentInfo

use of dev.dworks.apps.anexplorer.model.DocumentInfo in project AnExplorer by 1hakr.

the class StandaloneActivity method onCurrentDirectoryChanged.

private void onCurrentDirectoryChanged(int anim) {
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    mDirectoryContainer.setDrawDisappearingFirst(anim == ANIM_DOWN);
    if (cwd == null) {
        DirectoryFragment.showRecentsOpen(fm, anim);
        // Start recents in grid when requesting visual things
        final boolean visualMimes = MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes);
        mState.userMode = visualMimes ? State.MODE_GRID : State.MODE_LIST;
        mState.derivedMode = mState.userMode;
    } else {
        if (mState.currentSearch != null) {
            // Ongoing search
            DirectoryFragment.showSearch(fm, root, cwd, mState.currentSearch, anim);
        } else {
            // Normal boring directory
            DirectoryFragment.showNormal(fm, root, cwd, anim);
        }
    }
    final RootsFragment roots = RootsFragment.get(fm);
    if (roots != null) {
        roots.onCurrentRootChanged();
    }
    updateActionBar();
    supportInvalidateOptionsMenu();
    dumpStack();
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(dev.dworks.apps.anexplorer.model.RootInfo) RootsFragment(dev.dworks.apps.anexplorer.fragment.RootsFragment) DocumentInfo(dev.dworks.apps.anexplorer.model.DocumentInfo)

Example 7 with DocumentInfo

use of dev.dworks.apps.anexplorer.model.DocumentInfo in project AnExplorer by 1hakr.

the class StandaloneActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    final MenuItem createDir = menu.findItem(R.id.menu_create_dir);
    final MenuItem search = menu.findItem(R.id.menu_search);
    final MenuItem sort = menu.findItem(R.id.menu_sort);
    final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
    final MenuItem grid = menu.findItem(R.id.menu_grid);
    final MenuItem list = menu.findItem(R.id.menu_list);
    sort.setVisible(cwd != null);
    grid.setVisible(mState.derivedMode != State.MODE_GRID);
    list.setVisible(mState.derivedMode != State.MODE_LIST);
    if (mState.currentSearch != null) {
        // Search uses backend ranking; no sorting
        sort.setVisible(false);
        search.expandActionView();
        mSearchView.setIconified(false);
        mSearchView.clearFocus();
        mSearchView.setQuery(mState.currentSearch, false);
    } else {
        mIgnoreNextClose = true;
        mSearchView.setIconified(true);
        mSearchView.clearFocus();
        mIgnoreNextCollapse = true;
        search.collapseActionView();
    }
    // Only sort by size when visible
    sortSize.setVisible(mState.showSize);
    search.setVisible(true);
    createDir.setVisible(true);
    return true;
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(dev.dworks.apps.anexplorer.model.RootInfo) MenuItem(android.view.MenuItem) DocumentInfo(dev.dworks.apps.anexplorer.model.DocumentInfo)

Example 8 with DocumentInfo

use of dev.dworks.apps.anexplorer.model.DocumentInfo in project AnExplorer by 1hakr.

the class CreateDirectoryFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
    final View view = dialogInflater.inflate(R.layout.dialog_create_dir, null, false);
    final EditText text1 = (EditText) view.findViewById(android.R.id.text1);
    Utils.tintWidget(text1);
    builder.setTitle(R.string.menu_create_dir);
    builder.setView(view);
    builder.setPositiveButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            final String displayName = text1.getText().toString();
            final BaseActivity activity = (BaseActivity) getActivity();
            final DocumentInfo cwd = activity.getCurrentDirectory();
            if (TextUtils.isEmpty(displayName)) {
                activity.showError(R.string.create_error);
                return;
            }
            new CreateDirectoryTask(activity, cwd, displayName).executeOnExecutor(ProviderExecutor.forAuthority(cwd.authority));
        }
    });
    builder.setNegativeButton(android.R.string.cancel, null);
    return builder.create();
}
Also used : Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) View(android.view.View) LayoutInflater(android.view.LayoutInflater) BaseActivity(dev.dworks.apps.anexplorer.BaseActivity) OnClickListener(android.content.DialogInterface.OnClickListener) DocumentInfo(dev.dworks.apps.anexplorer.model.DocumentInfo)

Example 9 with DocumentInfo

use of dev.dworks.apps.anexplorer.model.DocumentInfo in project AnExplorer by 1hakr.

the class DocumentsActivity method dumpStack.

private void dumpStack() {
    Log.d(TAG, "Current stack: ");
    Log.d(TAG, " * " + mState.stack.root);
    for (DocumentInfo doc : mState.stack) {
        Log.d(TAG, " +-- " + doc);
    }
}
Also used : DocumentInfo(dev.dworks.apps.anexplorer.model.DocumentInfo)

Example 10 with DocumentInfo

use of dev.dworks.apps.anexplorer.model.DocumentInfo in project AnExplorer by 1hakr.

the class DocumentsActivity method updateMenuItems.

public void updateMenuItems(Menu menu) {
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    if (isTelevision()) {
        menu.findItem(R.id.menu_create_dir).setVisible(showActionMenu());
        menu.findItem(R.id.menu_create_file).setVisible(showActionMenu());
    }
    final MenuItem search = menu.findItem(R.id.menu_search);
    final MenuItem sort = menu.findItem(R.id.menu_sort);
    final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
    final MenuItem grid = menu.findItem(R.id.menu_grid);
    final MenuItem list = menu.findItem(R.id.menu_list);
    final MenuItem settings = menu.findItem(R.id.menu_settings);
    // Open drawer means we hide most actions
    if (isRootsDrawerOpen()) {
        search.setVisible(false);
        sort.setVisible(false);
        grid.setVisible(false);
        list.setVisible(false);
        mIgnoreNextCollapse = true;
        search.collapseActionView();
        return;
    }
    sort.setVisible(cwd != null);
    grid.setVisible(!RootInfo.isOtherRoot(getCurrentRoot()) && mState.derivedMode != MODE_GRID);
    list.setVisible(mState.derivedMode != MODE_LIST);
    if (mState.currentSearch != null) {
        // Search uses backend ranking; no sorting
        // sort.setVisible(false);
        search.expandActionView();
        mSearchView.setIconified(false);
        mSearchView.clearFocus();
        mSearchView.setQuery(mState.currentSearch, false);
    } else {
        mIgnoreNextClose = true;
        mSearchView.setIconified(true);
        mSearchView.clearFocus();
        mIgnoreNextCollapse = true;
        search.collapseActionView();
    }
    // Only sort by size when visible
    sortSize.setVisible(mState.showSize);
    final boolean searchVisible;
    if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
        searchVisible = false;
        // No display options in recent directories
        if (cwd == null) {
            grid.setVisible(false);
            list.setVisible(false);
        }
        if (mState.action == State.ACTION_CREATE) {
            if (null != SaveFragment.get(fm))
                SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
        }
    } else {
        searchVisible = root != null && ((root.flags & Root.FLAG_SUPPORTS_SEARCH) != 0);
        // TODO: Is this useful?
        if (null != SaveFragment.get(fm))
            SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
        if (null != MoveFragment.get(fm))
            MoveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isMoveSupported());
    }
    // TODO: close any search in-progress when hiding
    search.setVisible(searchVisible);
    settings.setVisible(mState.action != ACTION_MANAGE);
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(dev.dworks.apps.anexplorer.model.RootInfo) MenuItem(android.view.MenuItem) DocumentInfo(dev.dworks.apps.anexplorer.model.DocumentInfo)

Aggregations

DocumentInfo (dev.dworks.apps.anexplorer.model.DocumentInfo)20 Context (android.content.Context)6 ContentResolver (android.content.ContentResolver)5 Uri (android.net.Uri)5 RootInfo (dev.dworks.apps.anexplorer.model.RootInfo)5 ArrayList (java.util.ArrayList)5 FragmentManager (android.app.FragmentManager)4 Intent (android.content.Intent)4 OperationCanceledException (android.os.OperationCanceledException)4 DocumentInfo.getCursorString (dev.dworks.apps.anexplorer.model.DocumentInfo.getCursorString)4 Bundle (android.os.Bundle)3 MenuItem (android.view.MenuItem)3 ContentValues (android.content.ContentValues)2 DialogInterface (android.content.DialogInterface)2 OnClickListener (android.content.DialogInterface.OnClickListener)2 Cursor (android.database.Cursor)2 Point (android.graphics.Point)2 AlertDialog (android.support.v7.app.AlertDialog)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2