@@ -175,7 +175,12 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
175175
176176 storedItems = items
177177 ItemsAdapter (activity as SimpleActivity , storedItems, this @ItemsFragment, items_list, isPickMultipleIntent, items_fastscroller) {
178- itemClicked(it as FileDirItem )
178+ if ((it as ? ListItem )?.isSectionTitle == true ) {
179+ openDirectory(it.mPath)
180+ searchClosed()
181+ } else {
182+ itemClicked(it as FileDirItem )
183+ }
179184 }.apply {
180185 setupZoomListener(zoomListener)
181186 items_list.adapter = this
@@ -278,11 +283,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
278283
279284 private fun itemClicked (item : FileDirItem ) {
280285 if (item.isDirectory) {
281- (activity as ? MainActivity )?.apply {
282- skipItemUpdating = isSearchOpen
283- openedDirectory()
284- }
285- openPath(item.path)
286+ openDirectory(item.path)
286287 } else {
287288 val path = item.path
288289 if (isGetContentIntent) {
@@ -299,6 +300,14 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
299300 }
300301 }
301302
303+ private fun openDirectory (path : String ) {
304+ (activity as ? MainActivity )?.apply {
305+ skipItemUpdating = isSearchOpen
306+ openedDirectory()
307+ }
308+ openPath(path)
309+ }
310+
302311 fun searchQueryChanged (text : String ) {
303312 val searchText = text.trim()
304313 lastSearchedText = searchText
@@ -337,7 +346,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
337346 files.forEach {
338347 val parent = it.mPath.getParentPath()
339348 if (parent != previousParent && context != null ) {
340- listItems.add(ListItem (" " , context!! .humanizePath(parent), false , 0 , 0 , 0 , true ))
349+ val sectionTitle = ListItem (parent, context!! .humanizePath(parent), false , 0 , 0 , 0 , true )
350+ listItems.add(sectionTitle)
341351 previousParent = parent
342352 }
343353 listItems.add(it)
0 commit comments