adding some USB related improvements
This commit is contained in:
parent
e4b5f2e51e
commit
ba21946f8f
|
@ -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'
|
||||
|
|
|
@ -262,7 +262,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||
private fun getShortcutImage(path: String, drawable: Drawable, callback: () -> 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<ListItem
|
|||
}
|
||||
|
||||
private fun addFileUris(path: String, paths: ArrayList<String>) {
|
||||
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<ListItem
|
|||
val newPath = "$parentPath/$newFolderName/${entry.name.trimEnd('/')}"
|
||||
|
||||
val resolution = getConflictResolution(conflictResolutions, newPath)
|
||||
val doesPathExist = File(newPath).exists()
|
||||
val doesPathExist = activity.getDoesFilePathExist(newPath)
|
||||
if (doesPathExist && resolution == CONFLICT_OVERWRITE) {
|
||||
val fileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), entry.isDirectory)
|
||||
if (File(it).isDirectory) {
|
||||
if (activity.getIsPathDirectory(it)) {
|
||||
activity.deleteFolderBg(fileDirItem, false) {
|
||||
if (it) {
|
||||
extractEntry(newPath, entry, zipFile)
|
||||
|
@ -505,7 +505,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||
|
||||
private fun extractEntry(newPath: String, entry: ZipEntry, zipFile: ZipFile) {
|
||||
if (entry.isDirectory) {
|
||||
if (!activity.createDirectorySync(newPath) && !File(newPath).exists()) {
|
||||
if (!activity.createDirectorySync(newPath) && !activity.getDoesFilePathExist(newPath)) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_file), newPath)
|
||||
activity.showErrorToast(error)
|
||||
}
|
||||
|
@ -544,17 +544,17 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||
val base = mainFile.parentFile.toURI()
|
||||
res = zout
|
||||
queue.push(mainFile)
|
||||
if (mainFile.isDirectory) {
|
||||
if (activity.getIsPathDirectory(mainFile.absolutePath)) {
|
||||
name = "${mainFile.name.trimEnd('/')}/"
|
||||
zout.putNextEntry(ZipEntry(name))
|
||||
}
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
mainFile = queue.pop()
|
||||
if (mainFile.isDirectory) {
|
||||
if (activity.getIsPathDirectory(mainFile.absolutePath)) {
|
||||
for (file in mainFile.listFiles()) {
|
||||
name = base.relativize(file.toURI()).path
|
||||
if (file.isDirectory) {
|
||||
if (activity.getIsPathDirectory(file.absolutePath)) {
|
||||
queue.push(file)
|
||||
name = "${name.trimEnd('/')}/"
|
||||
zout.putNextEntry(ZipEntry(name))
|
||||
|
|
|
@ -8,14 +8,13 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.filemanager.pro.R
|
||||
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_compress_as.view.*
|
||||
import java.io.File
|
||||
|
||||
class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val callback: (destination: String) -> 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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue