Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public Cursor queryRoots(String[] projection) throws FileNotFoundException {
- final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
- final MatrixCursor.RowBuilder row = result.newRow();
- row.add(Root.COLUMN_ROOT_ID, BuildConfig.DOCUMENTS_AUTHORITY);
- row.add(Root.COLUMN_ICON, R.drawable.ic_menu_manage);
- row.add(Root.COLUMN_TITLE, "Root Title");
- row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_RECENTS);
- row.add(Root.COLUMN_SUMMARY, "USB Reader");
- row.add(Root.COLUMN_DOCUMENT_ID, "/");
- row.add(Root.COLUMN_MIME_TYPES, "*/*");
- Uri rootsUri = DocumentsContract.buildRootsUri(BuildConfig.DOCUMENTS_AUTHORITY);
- getContext().getContentResolver().notifyChange(rootsUri, null);
- return result;
- }
- */*
- @Override
- public Cursor queryChildDocuments(String parentDocumentId, String[] projection,
- String sortOrder) throws FileNotFoundException {
- final MatrixCursor result = new
- MatrixCursor(resolveDocumentProjection(projection));
- String parentDocumenPath = getContext().getFilesDir().getPath() + "/" + parentDocumentId;
- File dir = new File(parentDocumenPath);
- for (File file : dir.listFiles()) {
- String documentId = parentDocumentId + "/" + file.getName();
- includeFile(result, documentId);
- }
- return result;
- }
- if (id == R.id.nav_file_explorer) {
- Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
- startActivityForResult(intent, 1);
- }
Add Comment
Please, Sign In to add comment