use of com.android.documentsui.BaseActivity in project platform_frameworks_base by android.
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);
}
use of com.android.documentsui.BaseActivity in project platform_frameworks_base by android.
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;
}
use of com.android.documentsui.BaseActivity in project android_frameworks_base by DirtyUnicorns.
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;
}
use of com.android.documentsui.BaseActivity in project android_frameworks_base by DirtyUnicorns.
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);
}
use of com.android.documentsui.BaseActivity in project android_frameworks_base by crdroidandroid.
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;
}
Aggregations