diff --git a/app/build.gradle b/app/build.gradle index c72e24f0..bbdf2439 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.18.14' + implementation 'com.simplemobiletools:commons:5.18.30' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index 836fb424..2d879eba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt @@ -262,7 +262,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList Unit) { val appIconColor = baseConfig.appIconColor (drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_folder_background).applyColorFilter(appIconColor) - if (File(path).isDirectory) { + if (activity.getIsPathDirectory(path)) { callback() } else { Thread { @@ -297,7 +297,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList) { - if (File(path).isDirectory) { + if (activity.getIsPathDirectory(path)) { val shouldShowHidden = activity.config.shouldShowHidden if (activity.isPathOnOTG(path)) { activity.getDocumentFile(path)?.listFiles()?.filter { if (shouldShowHidden) true else !it.name!!.startsWith(".") }?.forEach { @@ -471,10 +471,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList Unit) { private val view = activity.layoutInflater.inflate(R.layout.dialog_compress_as, null) init { val filename = path.getFilenameFromPath() - val indexOfDot = if (filename.contains('.') && !File(path).isDirectory) filename.lastIndexOf(".") else filename.length + val indexOfDot = if (filename.contains('.') && !activity.getIsPathDirectory(path)) filename.lastIndexOf(".") else filename.length val baseFilename = filename.substring(0, indexOfDot) var realPath = path.getParentPath() @@ -43,7 +42,7 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c name.isEmpty() -> activity.toast(R.string.empty_name) name.isAValidFilename() -> { val newPath = "$realPath/$name.zip" - if (File(newPath).exists()) { + if (activity.getDoesFilePathExist(newPath)) { activity.toast(R.string.name_taken) return@OnClickListener } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index 931eef1b..8046e712 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -26,7 +26,7 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca activity.toast(R.string.empty_name) } else if (name.isAValidFilename()) { val newPath = "$path/$name" - if (File(newPath).exists()) { + if (activity.getDoesFilePathExist(newPath)) { activity.toast(R.string.name_taken) return@OnClickListener } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/SaveAsDialog.kt index 2dc543aa..97fab1b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/SaveAsDialog.kt @@ -7,7 +7,6 @@ import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.filemanager.pro.R import kotlinx.android.synthetic.main.dialog_save_as.view.* -import java.io.File class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val callback: (savePath: String) -> Unit) { @@ -65,7 +64,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val callb return@setOnClickListener } - if (File(newPath).exists()) { + if (activity.getDoesFilePathExist(newPath)) { val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename) ConfirmationDialog(activity, title) { callback(newPath)