|
|
|
@ -88,10 +88,8 @@ object DocumentUtils { |
|
|
|
|
val docList = arrayListOf<DocItem>() |
|
|
|
|
var c: Cursor? = null |
|
|
|
|
try { |
|
|
|
|
val childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree( |
|
|
|
|
uri, |
|
|
|
|
DocumentsContract.getDocumentId(uri) |
|
|
|
|
) |
|
|
|
|
val childrenUri = DocumentsContract |
|
|
|
|
.buildChildDocumentsUriUsingTree(uri, DocumentsContract.getDocumentId(uri)) |
|
|
|
|
c = context.contentResolver.query( |
|
|
|
|
childrenUri, arrayOf( |
|
|
|
|
DocumentsContract.Document.COLUMN_DOCUMENT_ID, |
|
|
|
@ -107,7 +105,7 @@ object DocumentUtils { |
|
|
|
|
val sci = c.getColumnIndex(DocumentsContract.Document.COLUMN_SIZE) |
|
|
|
|
val mci = c.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE) |
|
|
|
|
val dci = c.getColumnIndex(DocumentsContract.Document.COLUMN_LAST_MODIFIED) |
|
|
|
|
c.moveToFirst() |
|
|
|
|
if (c.moveToFirst()) { |
|
|
|
|
do { |
|
|
|
|
val item = DocItem( |
|
|
|
|
name = c.getString(nci), |
|
|
|
@ -119,6 +117,7 @@ object DocumentUtils { |
|
|
|
|
docList.add(item) |
|
|
|
|
} while (c.moveToNext()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
e.printStackTrace() |
|
|
|
|
} finally { |
|
|
|
|