@@ -346,12 +346,21 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
346346 var previousParent = " "
347347 files.forEach {
348348 val parent = it.mPath.getParentPath()
349- if (parent != previousParent && context != null ) {
349+ if (! it.isDirectory && parent != previousParent && context != null ) {
350350 val sectionTitle = ListItem (parent, context!! .humanizePath(parent), false , 0 , 0 , 0 , true )
351351 listItems.add(sectionTitle)
352352 previousParent = parent
353353 }
354- listItems.add(it)
354+
355+ if (it.isDirectory) {
356+ val sectionTitle = ListItem (it.path, context!! .humanizePath(it.path), true , 0 , 0 , 0 , true )
357+ listItems.add(sectionTitle)
358+ previousParent = parent
359+ }
360+
361+ if (! it.isDirectory) {
362+ listItems.add(it)
363+ }
355364 }
356365
357366 activity?.runOnUiThread {
@@ -378,6 +387,13 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
378387 val isSortingBySize = sorting and SORT_BY_SIZE != 0
379388 File (path).listFiles()?.sortedBy { it.isDirectory }?.forEach {
380389 if (it.isDirectory) {
390+ if (it.name.contains(text, true )) {
391+ val fileDirItem = getFileDirItemFromFile(it, isSortingBySize, HashMap <String , Long >(), false )
392+ if (fileDirItem != null ) {
393+ files.add(fileDirItem)
394+ }
395+ }
396+
381397 files.addAll(searchFiles(text, it.absolutePath))
382398 } else {
383399 if (it.name.contains(text, true )) {
0 commit comments