Search in sources :

Example 6 with BaseActivity

use of com.android.documentsui.BaseActivity in project android_frameworks_base by crdroidandroid.

the class RenameDocumentFragment method renameDocuments.

private void renameDocuments(String newDisplayName) {
    BaseActivity activity = (BaseActivity) getActivity();
    if (isValidDocumentName(newDisplayName)) {
        new RenameDocumentsTask(activity, newDisplayName).execute(mDocument);
    } else {
        Log.w(TAG, "Failed to rename file - invalid name:" + newDisplayName);
        Snackbars.makeSnackbar(getActivity(), R.string.rename_error, Snackbar.LENGTH_SHORT).show();
    }
}
Also used : BaseActivity(com.android.documentsui.BaseActivity)

Example 7 with BaseActivity

use of com.android.documentsui.BaseActivity in project android_frameworks_base by crdroidandroid.

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 8 with BaseActivity

use of com.android.documentsui.BaseActivity in project platform_frameworks_base by android.

the class RenameDocumentFragment method renameDocuments.

private void renameDocuments(String newDisplayName) {
    BaseActivity activity = (BaseActivity) getActivity();
    if (isValidDocumentName(newDisplayName)) {
        new RenameDocumentsTask(activity, newDisplayName).execute(mDocument);
    } else {
        Log.w(TAG, "Failed to rename file - invalid name:" + newDisplayName);
        Snackbars.makeSnackbar(getActivity(), R.string.rename_error, Snackbar.LENGTH_SHORT).show();
    }
}
Also used : BaseActivity(com.android.documentsui.BaseActivity)

Example 9 with BaseActivity

use of com.android.documentsui.BaseActivity 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 10 with BaseActivity

use of com.android.documentsui.BaseActivity in project android_frameworks_base by AOSPA.

the class DirectoryFragment method handleViewItem.

private boolean handleViewItem(String id) {
    final Cursor cursor = mModel.getItem(id);
    if (cursor == null) {
        Log.w(TAG, "Can't view item. Can't obtain cursor for modeId" + id);
        return false;
    }
    final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
    final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
    if (mTuner.isDocumentEnabled(docMimeType, docFlags)) {
        final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
        ((BaseActivity) getActivity()).onDocumentPicked(doc, mModel);
        mSelectionManager.clearSelection();
        return true;
    }
    return false;
}
Also used : BaseActivity(com.android.documentsui.BaseActivity) DocumentInfo.getCursorString(com.android.documentsui.model.DocumentInfo.getCursorString) Cursor(android.database.Cursor) Point(android.graphics.Point) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Aggregations

BaseActivity (com.android.documentsui.BaseActivity)15 Cursor (android.database.Cursor)5 Point (android.graphics.Point)5 DocumentInfo (com.android.documentsui.model.DocumentInfo)5 DocumentInfo.getCursorString (com.android.documentsui.model.DocumentInfo.getCursorString)5 DocumentStack (com.android.documentsui.model.DocumentStack)5