From 0467112cc7f6d110722b5ede30cbe71627fb26af Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 21 Feb 2018 21:38:26 +0100 Subject: [PATCH] update commons to 3.12.17 --- app/build.gradle | 2 +- .../filemanager/activities/MainActivity.kt | 2 +- .../filemanager/adapters/ItemsAdapter.kt | 7 ++++--- .../filemanager/extensions/Context.kt | 4 ++-- .../filemanager/fragments/ItemsFragment.kt | 2 +- .../simplemobiletools/filemanager/helpers/Config.kt | 6 +++--- .../filemanager/helpers/RootHelpers.kt | 10 ++++++---- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2ff65971..caf54370 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,7 +45,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.12.5' + implementation 'com.simplemobiletools:commons:3.12.17' implementation files('../libs/RootTools.jar') diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt index 91d0086c..d741e434 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt @@ -202,7 +202,7 @@ class MainActivity : SimpleActivity() { val file = File(path) if (file.exists() && !file.isDirectory) { newPath = file.parent - } else if (!file.exists() && !isPathOnOTG(newPath)) { + } else if (!file.exists() && !newPath.startsWith(OTG_PATH)) { newPath = internalStoragePath } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt index 0c30242c..b9d551e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt @@ -20,6 +20,7 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.CONFLICT_OVERWRITE import com.simplemobiletools.commons.helpers.CONFLICT_SKIP +import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView @@ -154,7 +155,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList) { if (activity.getIsPathDirectory(path)) { val shouldShowHidden = activity.config.shouldShowHidden - if (activity.isPathOnOTG(path)) { + if (path.startsWith(OTG_PATH)) { activity.getDocumentFile(path)?.listFiles()?.filter { if (shouldShowHidden) true else !it.name.startsWith(".") }?.forEach { addFileUris(it.uri.toString(), paths) } @@ -227,7 +228,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList var line = lines[index] if (line.isNotEmpty() && line != "0") { - line = line.substring(fileDirItem.path.length).trim() - val size = line.split(" ")[0] - if (size.areDigitsOnly()) { - fileDirItem.size = size.toLong() + if (line.length >= fileDirItem.path.length) { + line = line.substring(fileDirItem.path.length).trim() + val size = line.split(" ")[0] + if (size.areDigitsOnly()) { + fileDirItem.size = size.toLong() + } } } }