improve OTG file fetching

This commit is contained in:
tibbi 2019-03-27 21:44:54 +01:00
parent 174d55ee37
commit 521545191c

View File

@ -174,12 +174,13 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
skipItemUpdating = false skipItemUpdating = false
Thread { Thread {
if (activity?.isDestroyed == false && activity?.isFinishing == false) { if (activity?.isDestroyed == false && activity?.isFinishing == false) {
if (context!!.isPathOnOTG(path)) { val config = context!!.config
val getProperFileSize = context!!.config.sorting and SORT_BY_SIZE != 0 if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) {
context!!.getOTGItems(path, context!!.config.shouldShowHidden, getProperFileSize) { val getProperFileSize = config.sorting and SORT_BY_SIZE != 0
context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) {
callback(path, getListItemsFromFileDirItems(it)) callback(path, getListItemsFromFileDirItems(it))
} }
} else if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) { } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) {
getRegularItemsOf(path, callback) getRegularItemsOf(path, callback)
} else { } else {
RootHelpers(activity!!).getFiles(path, callback) RootHelpers(activity!!).getFiles(path, callback)