~xdavidwu/saf-cephfs

87653a94d7e9eac5754a40a8a632120bf144331f — xdavidwu 3 years ago e882e38
DocumentsProvider: isChildDocument support

This add support for ACTION_OPEN_DOCUMENT_TREE
1 files changed, 6 insertions(+), 1 deletions(-)

M src/main/java/org/safcephfs/CephFSDocumentsProvider.java
M src/main/java/org/safcephfs/CephFSDocumentsProvider.java => src/main/java/org/safcephfs/CephFSDocumentsProvider.java +6 -1
@@ 209,6 209,11 @@ public class CephFSDocumentsProvider extends DocumentsProvider {
		return parentDocumentId + "/" + displayName;
	}

	public boolean isChildDocument(String parentDocumentId, String documentId) {
		return documentId.startsWith(parentDocumentId) &&
			documentId.charAt(parentDocumentId.length()) == '/';
	}

	public ParcelFileDescriptor openDocument(String documentId,
			String mode, CancellationSignal cancellationSignal)
			throws UnsupportedOperationException,


@@ 351,7 356,7 @@ public class CephFSDocumentsProvider extends DocumentsProvider {
		MatrixCursor.RowBuilder row = result.newRow();
		row.add(Root.COLUMN_ROOT_ID, id + "@" + mon + ":" + path);
		row.add(Root.COLUMN_DOCUMENT_ID, "root/");
		row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE);
		row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD);
		row.add(Root.COLUMN_TITLE,"CephFS " + mon + ":" + path);
		row.add(Root.COLUMN_ICON, R.mipmap.sym_def_app_icon);
		row.add(Root.COLUMN_SUMMARY, id);