Skip to content

Commit b8a58a5

Browse files
author
Laks Castro
authored
(#59) Tiny comment improvements
1 parent 982cbae commit b8a58a5

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

  • android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib

android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,23 @@ fun traverseDirectoryEntries(
164164
block: (data: Map<String, Any>, isLast: Boolean) -> Unit
165165
): Boolean {
166166

167-
168167
var childrenUritmp: Uri?;
169168

170-
171-
//https://stackoverflow.com/questions/41096332/issues-traversing-through-directory-hierarchy-with-android-storage-access-framew
172-
//Credit to user: Foobnix
173-
//If we were to always use getTreeDocumentId, it would apparently always only list the top level folder even if you request a subfolder
174-
169+
// https://stackoverflow.com/questions/41096332/issues-traversing-through-directory-hierarchy-with-android-storage-access-framew
170+
// Credit to user: Foobnix
171+
// If we were to always use getTreeDocumentId, it would apparently always only list the top level folder even if you request a subfolder
175172
try {
176-
//for childs and sub child dirs
173+
// for childs and sub child dirs
177174
childrenUritmp = DocumentsContract.buildChildDocumentsUriUsingTree(rootUri, DocumentsContract.getDocumentId(rootUri));
178-
} catch (e:Exception) {
175+
} catch (e: Exception) {
179176
// for parent dir
180177
childrenUritmp = DocumentsContract.buildChildDocumentsUriUsingTree(rootUri, DocumentsContract.getTreeDocumentId(rootUri));
181178
}
182179

180+
// TODO(@EternityForest, @lakscastro): Remove this variable and use: `val childrenUri = try { ... } catch (e: Exception) { ... }`
183181
val childrenUri = childrenUritmp as Uri;
184182

185-
/// Keep track of our directory hierarchy
183+
// Keep track of our directory hierarchy
186184
val dirNodes = mutableListOf<Pair<Uri, Uri>>(Pair(rootUri, childrenUri))
187185

188186
while (dirNodes.isNotEmpty()) {
@@ -203,7 +201,7 @@ fun traverseDirectoryEntries(
203201
val cursor = contentResolver.query(
204202
children,
205203
projection,
206-
/// TODO: Add support for `selection`, `selectionArgs` and `sortOrder`
204+
// TODO: Add support for `selection`, `selectionArgs` and `sortOrder`
207205
null,
208206
null,
209207
null
@@ -283,7 +281,7 @@ fun bitmapToBase64(bitmap: Bitmap): String {
283281
}
284282

285283
/**
286-
* Trick to verify if is a tree URi even not in API 26+
284+
* Trick to verify if is a tree URI even not in API 26+
287285
*/
288286
fun isTreeUri(uri: Uri): Boolean {
289287
if (Build.VERSION.SDK_INT >= API_24) {

0 commit comments

Comments
 (0)