update commons to 3.11.42
This commit is contained in:
parent
345af31cd0
commit
ce9da1b173
|
@ -45,7 +45,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.11.38'
|
||||
implementation 'com.simplemobiletools:commons:3.11.42'
|
||||
|
||||
implementation files('../libs/RootTools.jar')
|
||||
|
||||
|
|
|
@ -180,11 +180,12 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
|
||||
private fun copyMoveTo(isCopyOperation: Boolean) {
|
||||
val files = ArrayList<FileDirItem>()
|
||||
selectedPositions.forEach { fileDirItems[it] }
|
||||
selectedPositions.forEach { files.add(fileDirItems[it]) }
|
||||
|
||||
val source = if (!files[0].isDirectory) File(files[0].path).parent else files[0].path
|
||||
val firstFile = files[0]
|
||||
val source = if (!firstFile.isDirectory) firstFile.path.substring(0, firstFile.path.length - firstFile.name.length) else firstFile.path
|
||||
FilePickerDialog(activity, source, false, activity.config.shouldShowHidden, true) {
|
||||
if (activity.isPathOnRoot(source)) {
|
||||
if (activity.isPathOnRoot(it)) {
|
||||
copyRootItems(files, it)
|
||||
} else {
|
||||
activity.copyMoveFilesTo(files, source, it, isCopyOperation, false, activity.config.shouldShowHidden) {
|
||||
|
@ -268,7 +269,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
val entry = entries.nextElement()
|
||||
val file = File(it.parent, entry.name)
|
||||
if (entry.isDirectory) {
|
||||
if (!activity.createDirectorySync(file)) {
|
||||
if (!activity.createDirectorySync(file.absolutePath)) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_file), file.absolutePath)
|
||||
activity.showErrorToast(error)
|
||||
return false
|
||||
|
|
|
@ -51,7 +51,7 @@ class CreateNewItemDialog(val activity: BaseSimpleActivity, val path: String, va
|
|||
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
|
||||
when {
|
||||
activity.needsStupidWritePermissions(this.path) -> activity.handleSAFDialog(path) {
|
||||
val documentFile = activity.getFileDocument(path)
|
||||
val documentFile = activity.getDocumentFile(path)
|
||||
if (documentFile == null) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
|
||||
activity.showErrorToast(error)
|
||||
|
@ -72,7 +72,7 @@ class CreateNewItemDialog(val activity: BaseSimpleActivity, val path: String, va
|
|||
try {
|
||||
if (activity.needsStupidWritePermissions(path)) {
|
||||
activity.handleSAFDialog(path) {
|
||||
val documentFile = activity.getFileDocument(path)
|
||||
val documentFile = activity.getDocumentFile(path)
|
||||
if (documentFile == null) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_file), path)
|
||||
activity.showErrorToast(error)
|
||||
|
|
|
@ -176,7 +176,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||
Thread {
|
||||
if (activity?.isActivityDestroyed() == false) {
|
||||
if (context!!.isPathOnOTG(path)) {
|
||||
context!!.getOTGItems(path) {
|
||||
val getProperFileSize = context!!.config.sorting and SORT_BY_SIZE != 0
|
||||
context!!.getOTGItems(path, context!!.config.shouldShowHidden, getProperFileSize) {
|
||||
callback(path, it)
|
||||
}
|
||||
} else if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package com.simplemobiletools.filemanager.helpers
|
||||
|
||||
import android.content.Context
|
||||
import com.simplemobiletools.commons.extensions.getFileDocument
|
||||
import com.simplemobiletools.commons.extensions.getDocumentFile
|
||||
import com.simplemobiletools.commons.extensions.getInternalStoragePath
|
||||
import com.simplemobiletools.commons.extensions.isPathOnOTG
|
||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
||||
import java.io.File
|
||||
|
||||
class Config(context: Context) : BaseConfig(context) {
|
||||
|
@ -27,7 +26,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get(): String {
|
||||
var path = prefs.getString(HOME_FOLDER, "")
|
||||
if (path.isEmpty() ||
|
||||
(context.isPathOnOTG(path) && context.getFileDocument(path)?.isDirectory != true) ||
|
||||
(context.isPathOnOTG(path) && context.getDocumentFile(path)?.isDirectory != true) ||
|
||||
(!context.isPathOnOTG(path) && !File(path).isDirectory)) {
|
||||
path = context.getInternalStoragePath()
|
||||
homeFolder = path
|
||||
|
@ -67,10 +66,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getStringSet(FAVORITES, HashSet<String>())
|
||||
set(favorites) = prefs.edit().remove(FAVORITES).putStringSet(FAVORITES, favorites).apply()
|
||||
|
||||
var sorting: Int
|
||||
get() = prefs.getInt(SORT_ORDER, SORT_BY_NAME)
|
||||
set(sorting) = prefs.edit().putInt(SORT_ORDER, sorting).apply()
|
||||
|
||||
fun saveFolderSorting(path: String, value: Int) {
|
||||
if (path.isEmpty()) {
|
||||
sorting = value
|
||||
|
|
|
@ -6,7 +6,6 @@ const val PATH = "path"
|
|||
const val SHOW_HIDDEN = "show_hidden"
|
||||
const val HOME_FOLDER = "home_folder"
|
||||
const val FAVORITES = "favorites"
|
||||
const val SORT_ORDER = "sort_order"
|
||||
const val SORT_FOLDER_PREFIX = "sort_folder_"
|
||||
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||
const val IS_ROOT_AVAILABLE = "is_root_available"
|
||||
|
|
Loading…
Reference in New Issue