Skip to content

Commit 69e83ca

Browse files
committed
Completes #5.
1 parent 3c69792 commit 69e83ca

4 files changed

Lines changed: 19 additions & 7 deletions

File tree

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ allprojects {
2323

2424
plugins.withId("com.vanniktech.maven.publish.base") {
2525
group "com.lazygeniouz"
26-
version "1.0.6"
26+
version "1.0.8"
2727

2828
mavenPublishing {
2929
signAllPublications()
3030
pomFromGradleProperties()
31-
publishToMavenCentral("S01", true)
31+
publishToMavenCentral(SonatypeHost.S01, true)
3232
configure(new AndroidSingleVariantLibrary("release"))
3333
}
3434
}
3535
}
3636

37-
task clean(type: Delete) {
37+
tasks.register('clean', Delete) {
3838
delete rootProject.buildDir
3939
}

dfc/src/main/java/com/lazygeniouz/dfc/controller/DocumentController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class DocumentController(
3434
internal fun listFiles(): List<DocumentFileCompat> {
3535
return if (!isDirectory())
3636
throw UnsupportedOperationException("Selected document is not a Directory.")
37-
else ResolverCompat.listFiles(context, fileUri)
37+
else ResolverCompat.listFiles(context, fileCompat)
3838
}
3939

4040
/**

dfc/src/main/java/com/lazygeniouz/dfc/file/DocumentFileCompat.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ abstract class DocumentFileCompat constructor(
110110
var uri: Uri = uri
111111
internal set
112112

113+
/**
114+
* Return the parent file of this document.
115+
*
116+
* This will be null if called inside the selected directory.\
117+
* Should return the correct parent file for child items inside the selected directory.
118+
*/
119+
var parentFile: DocumentFileCompat? = null
120+
internal set
121+
113122
/**
114123
* Get the extension of the Document **File**.
115124
*/

dfc/src/main/java/com/lazygeniouz/dfc/resolver/ResolverCompat.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ internal object ResolverCompat {
9696
/**
9797
* Queries the ContentResolver & builds a list of [DocumentFileCompat] with all the required fields.
9898
*/
99-
internal fun listFiles(context: Context, uri: Uri): List<DocumentFileCompat> {
99+
internal fun listFiles(context: Context, file: DocumentFileCompat): List<DocumentFileCompat> {
100+
val uri = file.uri
100101
val childrenUri = createChildrenUri(uri)
101-
// empty list
102102
val listOfDocuments = arrayListOf<DocumentFileCompat>()
103103

104104
getCursor(context, childrenUri, fullProjection)?.use { cursor ->
@@ -116,7 +116,10 @@ internal object ResolverCompat {
116116
context, documentUri, documentName,
117117
documentSize, documentLastModified,
118118
documentMimeType, documentFlags
119-
).also { childFile -> listOfDocuments.add(childFile) }
119+
).also { childFile ->
120+
childFile.parentFile = file
121+
listOfDocuments.add(childFile)
122+
}
120123
}
121124
}
122125

0 commit comments

Comments
 (0)