From 521545191c30c357d2ceffc73251cfecf3c4fbc4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Mar 2019 21:44:54 +0100 Subject: [PATCH] improve OTG file fetching --- .../filemanager/pro/fragments/ItemsFragment.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index 0585e898..c310b2e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -174,12 +174,13 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb skipItemUpdating = false Thread { if (activity?.isDestroyed == false && activity?.isFinishing == false) { - if (context!!.isPathOnOTG(path)) { - val getProperFileSize = context!!.config.sorting and SORT_BY_SIZE != 0 - context!!.getOTGItems(path, context!!.config.shouldShowHidden, getProperFileSize) { + val config = context!!.config + if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { + val getProperFileSize = config.sorting and SORT_BY_SIZE != 0 + context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { callback(path, getListItemsFromFileDirItems(it)) } - } else if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) { + } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { getRegularItemsOf(path, callback) } else { RootHelpers(activity!!).getFiles(path, callback)