Skip to content

Commit 0467112

Browse files
committed
update commons to 3.12.17
1 parent eebd4c8 commit 0467112

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ext {
4545
}
4646

4747
dependencies {
48-
implementation 'com.simplemobiletools:commons:3.12.5'
48+
implementation 'com.simplemobiletools:commons:3.12.17'
4949

5050
implementation files('../libs/RootTools.jar')
5151

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class MainActivity : SimpleActivity() {
202202
val file = File(path)
203203
if (file.exists() && !file.isDirectory) {
204204
newPath = file.parent
205-
} else if (!file.exists() && !isPathOnOTG(newPath)) {
205+
} else if (!file.exists() && !newPath.startsWith(OTG_PATH)) {
206206
newPath = internalStoragePath
207207
}
208208

app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog
2020
import com.simplemobiletools.commons.extensions.*
2121
import com.simplemobiletools.commons.helpers.CONFLICT_OVERWRITE
2222
import com.simplemobiletools.commons.helpers.CONFLICT_SKIP
23+
import com.simplemobiletools.commons.helpers.OTG_PATH
2324
import com.simplemobiletools.commons.models.FileDirItem
2425
import com.simplemobiletools.commons.views.FastScroller
2526
import com.simplemobiletools.commons.views.MyRecyclerView
@@ -154,7 +155,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
154155
private fun addFileUris(path: String, paths: ArrayList<String>) {
155156
if (activity.getIsPathDirectory(path)) {
156157
val shouldShowHidden = activity.config.shouldShowHidden
157-
if (activity.isPathOnOTG(path)) {
158+
if (path.startsWith(OTG_PATH)) {
158159
activity.getDocumentFile(path)?.listFiles()?.filter { if (shouldShowHidden) true else !it.name.startsWith(".") }?.forEach {
159160
addFileUris(it.uri.toString(), paths)
160161
}
@@ -227,7 +228,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
227228

228229
private fun compressSelection() {
229230
val firstPath = fileDirItems[selectedPositions.first()].path
230-
if (activity.isPathOnOTG(firstPath)) {
231+
if (firstPath.startsWith(OTG_PATH)) {
231232
activity.toast(R.string.unknown_error_occurred)
232233
return
233234
}
@@ -253,7 +254,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
253254

254255
private fun decompressSelection() {
255256
val firstPath = fileDirItems[selectedPositions.first()].path
256-
if (activity.isPathOnOTG(firstPath)) {
257+
if (firstPath.startsWith(OTG_PATH)) {
257258
activity.toast(R.string.unknown_error_occurred)
258259
return
259260
}

app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/Context.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package com.simplemobiletools.filemanager.extensions
22

33
import android.content.Context
44
import com.simplemobiletools.commons.extensions.hasExternalSDCard
5-
import com.simplemobiletools.commons.extensions.isPathOnOTG
5+
import com.simplemobiletools.commons.helpers.OTG_PATH
66
import com.simplemobiletools.filemanager.helpers.Config
77

88
val Context.config: Config get() = Config.newInstance(applicationContext)
99

10-
fun Context.isPathOnRoot(path: String) = !(path.startsWith(config.internalStoragePath) || isPathOnOTG(path) || (hasExternalSDCard() && path.startsWith(config.sdCardPath)))
10+
fun Context.isPathOnRoot(path: String) = !(path.startsWith(config.internalStoragePath) || path.startsWith(OTG_PATH) || (hasExternalSDCard() && path.startsWith(config.sdCardPath)))

app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
175175
skipItemUpdating = false
176176
Thread {
177177
if (activity?.isActivityDestroyed() == false) {
178-
if (context!!.isPathOnOTG(path)) {
178+
if (path.startsWith(OTG_PATH)) {
179179
val getProperFileSize = context!!.config.sorting and SORT_BY_SIZE != 0
180180
context!!.getOTGItems(path, context!!.config.shouldShowHidden, getProperFileSize) {
181181
callback(path, it)

app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/Config.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package com.simplemobiletools.filemanager.helpers
33
import android.content.Context
44
import com.simplemobiletools.commons.extensions.getDocumentFile
55
import com.simplemobiletools.commons.extensions.getInternalStoragePath
6-
import com.simplemobiletools.commons.extensions.isPathOnOTG
76
import com.simplemobiletools.commons.helpers.BaseConfig
7+
import com.simplemobiletools.commons.helpers.OTG_PATH
88
import java.io.File
99

1010
class Config(context: Context) : BaseConfig(context) {
@@ -26,8 +26,8 @@ class Config(context: Context) : BaseConfig(context) {
2626
get(): String {
2727
var path = prefs.getString(HOME_FOLDER, "")
2828
if (path.isEmpty() ||
29-
(context.isPathOnOTG(path) && context.getDocumentFile(path)?.isDirectory != true) ||
30-
(!context.isPathOnOTG(path) && !File(path).isDirectory)) {
29+
(path.startsWith(OTG_PATH) && context.getDocumentFile(path)?.isDirectory != true) ||
30+
(!path.startsWith(OTG_PATH) && !File(path).isDirectory)) {
3131
path = context.getInternalStoragePath()
3232
homeFolder = path
3333
}

app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ class RootHelpers {
105105
files.forEachIndexed { index, fileDirItem ->
106106
var line = lines[index]
107107
if (line.isNotEmpty() && line != "0") {
108-
line = line.substring(fileDirItem.path.length).trim()
109-
val size = line.split(" ")[0]
110-
if (size.areDigitsOnly()) {
111-
fileDirItem.size = size.toLong()
108+
if (line.length >= fileDirItem.path.length) {
109+
line = line.substring(fileDirItem.path.length).trim()
110+
val size = line.split(" ")[0]
111+
if (size.areDigitsOnly()) {
112+
fileDirItem.size = size.toLong()
113+
}
112114
}
113115
}
114116
}

0 commit comments

Comments
 (0)