Search in sources :

Example 26 with DocumentStack

use of com.android.documentsui.model.DocumentStack in project android_frameworks_base by DirtyUnicorns.

the class AbstractJobTest method createJob.

final T createJob(List<Uri> srcs, Uri srcParent, Uri destination) throws Exception {
    DocumentStack stack = new DocumentStack();
    stack.push(DocumentInfo.fromUri(mResolver, destination));
    List<DocumentInfo> srcDocs = Lists.newArrayList();
    for (Uri src : srcs) {
        srcDocs.add(DocumentInfo.fromUri(mResolver, src));
    }
    return createJob(srcDocs, DocumentInfo.fromUri(mResolver, srcParent), stack);
}
Also used : DocumentStack(com.android.documentsui.model.DocumentStack) Uri(android.net.Uri) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 27 with DocumentStack

use of com.android.documentsui.model.DocumentStack in project android_frameworks_base by AOSPA.

the class DirectoryFragment method copyDocuments.

private void copyDocuments(final List<DocumentInfo> docs, final DocumentInfo destination) {
    BaseActivity activity = (BaseActivity) getActivity();
    if (!canCopy(docs, activity.getCurrentRoot(), destination)) {
        Snackbars.makeSnackbar(getActivity(), R.string.clipboard_files_cannot_paste, Snackbar.LENGTH_SHORT).show();
        return;
    }
    if (docs.isEmpty()) {
        return;
    }
    final DocumentStack curStack = getDisplayState().stack;
    DocumentStack tmpStack = new DocumentStack();
    if (destination != null) {
        tmpStack.push(destination);
        tmpStack.addAll(curStack);
    } else {
        tmpStack = curStack;
    }
    FileOperations.copy(getActivity(), docs, tmpStack);
}
Also used : BaseActivity(com.android.documentsui.BaseActivity) DocumentStack(com.android.documentsui.model.DocumentStack)

Example 28 with DocumentStack

use of com.android.documentsui.model.DocumentStack in project android_frameworks_base by AOSPA.

the class AbstractJobTest method createJob.

final T createJob(List<Uri> srcs, Uri srcParent, Uri destination) throws Exception {
    DocumentStack stack = new DocumentStack();
    stack.push(DocumentInfo.fromUri(mResolver, destination));
    List<DocumentInfo> srcDocs = Lists.newArrayList();
    for (Uri src : srcs) {
        srcDocs.add(DocumentInfo.fromUri(mResolver, src));
    }
    return createJob(srcDocs, DocumentInfo.fromUri(mResolver, srcParent), stack);
}
Also used : DocumentStack(com.android.documentsui.model.DocumentStack) Uri(android.net.Uri) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 29 with DocumentStack

use of com.android.documentsui.model.DocumentStack in project android_frameworks_base by AOSPA.

the class FilesActivity method includeState.

@Override
void includeState(State state) {
    final Intent intent = getIntent();
    state.action = State.ACTION_BROWSE;
    state.allowMultiple = true;
    // Options specific to the DocumentsActivity.
    assert (!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY));
    final DocumentStack stack = intent.getParcelableExtra(Shared.EXTRA_STACK);
    if (stack != null) {
        state.stack = stack;
    }
}
Also used : Intent(android.content.Intent) DocumentStack(com.android.documentsui.model.DocumentStack)

Example 30 with DocumentStack

use of com.android.documentsui.model.DocumentStack in project android_frameworks_base by ResurrectionRemix.

the class DirectoryFragment method copyDocuments.

private void copyDocuments(final List<DocumentInfo> docs, final DocumentInfo destination) {
    BaseActivity activity = (BaseActivity) getActivity();
    if (!canCopy(docs, activity.getCurrentRoot(), destination)) {
        Snackbars.makeSnackbar(getActivity(), R.string.clipboard_files_cannot_paste, Snackbar.LENGTH_SHORT).show();
        return;
    }
    if (docs.isEmpty()) {
        return;
    }
    final DocumentStack curStack = getDisplayState().stack;
    DocumentStack tmpStack = new DocumentStack();
    if (destination != null) {
        tmpStack.push(destination);
        tmpStack.addAll(curStack);
    } else {
        tmpStack = curStack;
    }
    FileOperations.copy(getActivity(), docs, tmpStack);
}
Also used : BaseActivity(com.android.documentsui.BaseActivity) DocumentStack(com.android.documentsui.model.DocumentStack)

Aggregations

DocumentStack (com.android.documentsui.model.DocumentStack)35 DocumentInfo (com.android.documentsui.model.DocumentInfo)10 Context (android.content.Context)5 Intent (android.content.Intent)5 Loader (android.content.Loader)5 Cursor (android.database.Cursor)5 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)5 Uri (android.net.Uri)5 Bundle (android.os.Bundle)5 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 RecyclerView (android.support.v7.widget.RecyclerView)5 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 BaseActivity (com.android.documentsui.BaseActivity)5 DocumentInfo.getCursorString (com.android.documentsui.model.DocumentInfo.getCursorString)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5