Loading build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '3.12.3' propVersionName = '3.12.5' kotlin_version = '1.2.21' support_libs = '27.0.2' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +13 −13 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ open class BaseSimpleActivity : AppCompatActivity() { return } if (!doesFilePathExist(destination)) { if (!getDoesFilePathExist(destination)) { toast(R.string.invalid_destination) return } Loading @@ -202,11 +202,11 @@ open class BaseSimpleActivity : AppCompatActivity() { handleSAFDialog(destination) { copyMoveCallback = callback if (isCopyOperation) { startCopyMove(fileDirItems, FileDirItem(destination), isCopyOperation, copyPhotoVideoOnly, copyHidden) startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden) } else { if (isPathOnOTG(source) || isPathOnOTG(destination) || isPathOnSD(source) || isPathOnSD(destination) || fileDirItems.first().isDirectory || isNougatPlus()) { handleSAFDialog(source) { startCopyMove(fileDirItems, FileDirItem(destination), isCopyOperation, copyPhotoVideoOnly, copyHidden) startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden) } } else { toast(R.string.moving) Loading Loading @@ -239,15 +239,15 @@ open class BaseSimpleActivity : AppCompatActivity() { } } private fun startCopyMove(files: ArrayList<FileDirItem>, destinationFileDirItem: FileDirItem, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean) { checkConflict(files, destinationFileDirItem, 0, LinkedHashMap()) { private fun startCopyMove(files: ArrayList<FileDirItem>, destinationPath: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean) { checkConflicts(files, destinationPath, 0, LinkedHashMap()) { toast(if (isCopyOperation) R.string.copying else R.string.moving) val pair = Pair(files, destinationFileDirItem) val pair = Pair(files, destinationPath) CopyMoveTask(this, isCopyOperation, copyPhotoVideoOnly, it, copyMoveListener, copyHidden).execute(pair) } } private fun checkConflict(files: ArrayList<FileDirItem>, destinationFileDirItem: FileDirItem, index: Int, conflictResolutions: LinkedHashMap<String, Int>, fun checkConflicts(files: ArrayList<FileDirItem>, destinationPath: String, index: Int, conflictResolutions: LinkedHashMap<String, Int>, callback: (resolutions: LinkedHashMap<String, Int>) -> Unit) { if (index == files.size) { callback(conflictResolutions) Loading @@ -255,20 +255,20 @@ open class BaseSimpleActivity : AppCompatActivity() { } val file = files[index] val newFileDirItem = FileDirItem("${destinationFileDirItem.path}/${file.name}", file.name, file.isDirectory) if (doesFilePathExist(newFileDirItem.path)) { val newFileDirItem = FileDirItem("$destinationPath/${file.name}", file.name, file.isDirectory) if (getDoesFilePathExist(newFileDirItem.path)) { FileConflictDialog(this, newFileDirItem) { resolution, applyForAll -> if (applyForAll) { conflictResolutions.clear() conflictResolutions[""] = resolution checkConflict(files, destinationFileDirItem, files.size, conflictResolutions, callback) checkConflicts(files, destinationPath, files.size, conflictResolutions, callback) } else { conflictResolutions[newFileDirItem.path] = resolution checkConflict(files, destinationFileDirItem, index + 1, conflictResolutions, callback) checkConflicts(files, destinationPath, index + 1, conflictResolutions, callback) } } } else { checkConflict(files, destinationFileDirItem, index + 1, conflictResolutions, callback) checkConflicts(files, destinationPath, index + 1, conflictResolutions, callback) } } Loading commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +7 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import java.lang.ref.WeakReference import java.util.* class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = false, val copyMediaOnly: Boolean, val conflictResolutions: LinkedHashMap<String, Int>, listener: CopyMoveListener, val copyHidden: Boolean) : AsyncTask<Pair<ArrayList<FileDirItem>, FileDirItem>, Void, Boolean>() { listener: CopyMoveListener, val copyHidden: Boolean) : AsyncTask<Pair<ArrayList<FileDirItem>, String>, Void, Boolean>() { private val INITIAL_PROGRESS_DELAY = 3000L private val PROGRESS_RECHECK_INTERVAL = 500L Loading @@ -49,7 +49,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mNotificationBuilder = NotificationCompat.Builder(activity) } override fun doInBackground(vararg params: Pair<ArrayList<FileDirItem>, FileDirItem>): Boolean? { override fun doInBackground(vararg params: Pair<ArrayList<FileDirItem>, String>): Boolean? { if (params.isEmpty()) { return false } Loading @@ -60,7 +60,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mNotifId = (System.currentTimeMillis() / 1000).toInt() mMaxSize = 0 for (file in mFiles) { val newPath = "${pair.second!!.path}/${file.name}" val newPath = "${pair.second}/${file.name}" val fileExists = if (activity.isPathOnOTG(newPath)) activity.getFastDocumentFile(newPath)?.exists() ?: false else File(newPath).exists() if (getConflictResolution(newPath) != CONFLICT_SKIP || !fileExists) { Loading @@ -75,9 +75,9 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second!!.path}/${file.name}" val newPath = "${pair.second}/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) if (resolution == CONFLICT_SKIP) { mFileCountToCopy-- Loading Loading @@ -175,7 +175,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val children = activity.getDocumentFile(source.path)?.listFiles() ?: return for (child in children) { val newPath = "$destinationPath/${child.name}" if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { continue } Loading @@ -189,7 +189,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val children = File(source.path).list() for (child in children) { val newPath = "$destinationPath/$child" if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { continue } Loading commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/FilePickerDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class FilePickerDialog(val activity: BaseSimpleActivity, private var mDialogView = activity.layoutInflater.inflate(R.layout.dialog_filepicker, null) init { if (!activity.doesFilePathExist(currPath)) { if (!activity.getDoesFilePathExist(currPath)) { currPath = activity.internalStoragePath } Loading commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/PropertiesDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class PropertiesDialog() { * @param countHiddenItems toggle determining if we will count hidden files themselves and their sizes (reasonable only at directory properties) */ constructor(activity: Activity, path: String, countHiddenItems: Boolean = false) : this() { if (!activity.doesFilePathExist(path)) { if (!activity.getDoesFilePathExist(path)) { activity.toast(String.format(activity.getString(R.string.source_file_doesnt_exist), path)) return } Loading Loading
build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '3.12.3' propVersionName = '3.12.5' kotlin_version = '1.2.21' support_libs = '27.0.2' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +13 −13 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ open class BaseSimpleActivity : AppCompatActivity() { return } if (!doesFilePathExist(destination)) { if (!getDoesFilePathExist(destination)) { toast(R.string.invalid_destination) return } Loading @@ -202,11 +202,11 @@ open class BaseSimpleActivity : AppCompatActivity() { handleSAFDialog(destination) { copyMoveCallback = callback if (isCopyOperation) { startCopyMove(fileDirItems, FileDirItem(destination), isCopyOperation, copyPhotoVideoOnly, copyHidden) startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden) } else { if (isPathOnOTG(source) || isPathOnOTG(destination) || isPathOnSD(source) || isPathOnSD(destination) || fileDirItems.first().isDirectory || isNougatPlus()) { handleSAFDialog(source) { startCopyMove(fileDirItems, FileDirItem(destination), isCopyOperation, copyPhotoVideoOnly, copyHidden) startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden) } } else { toast(R.string.moving) Loading Loading @@ -239,15 +239,15 @@ open class BaseSimpleActivity : AppCompatActivity() { } } private fun startCopyMove(files: ArrayList<FileDirItem>, destinationFileDirItem: FileDirItem, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean) { checkConflict(files, destinationFileDirItem, 0, LinkedHashMap()) { private fun startCopyMove(files: ArrayList<FileDirItem>, destinationPath: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean) { checkConflicts(files, destinationPath, 0, LinkedHashMap()) { toast(if (isCopyOperation) R.string.copying else R.string.moving) val pair = Pair(files, destinationFileDirItem) val pair = Pair(files, destinationPath) CopyMoveTask(this, isCopyOperation, copyPhotoVideoOnly, it, copyMoveListener, copyHidden).execute(pair) } } private fun checkConflict(files: ArrayList<FileDirItem>, destinationFileDirItem: FileDirItem, index: Int, conflictResolutions: LinkedHashMap<String, Int>, fun checkConflicts(files: ArrayList<FileDirItem>, destinationPath: String, index: Int, conflictResolutions: LinkedHashMap<String, Int>, callback: (resolutions: LinkedHashMap<String, Int>) -> Unit) { if (index == files.size) { callback(conflictResolutions) Loading @@ -255,20 +255,20 @@ open class BaseSimpleActivity : AppCompatActivity() { } val file = files[index] val newFileDirItem = FileDirItem("${destinationFileDirItem.path}/${file.name}", file.name, file.isDirectory) if (doesFilePathExist(newFileDirItem.path)) { val newFileDirItem = FileDirItem("$destinationPath/${file.name}", file.name, file.isDirectory) if (getDoesFilePathExist(newFileDirItem.path)) { FileConflictDialog(this, newFileDirItem) { resolution, applyForAll -> if (applyForAll) { conflictResolutions.clear() conflictResolutions[""] = resolution checkConflict(files, destinationFileDirItem, files.size, conflictResolutions, callback) checkConflicts(files, destinationPath, files.size, conflictResolutions, callback) } else { conflictResolutions[newFileDirItem.path] = resolution checkConflict(files, destinationFileDirItem, index + 1, conflictResolutions, callback) checkConflicts(files, destinationPath, index + 1, conflictResolutions, callback) } } } else { checkConflict(files, destinationFileDirItem, index + 1, conflictResolutions, callback) checkConflicts(files, destinationPath, index + 1, conflictResolutions, callback) } } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +7 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import java.lang.ref.WeakReference import java.util.* class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = false, val copyMediaOnly: Boolean, val conflictResolutions: LinkedHashMap<String, Int>, listener: CopyMoveListener, val copyHidden: Boolean) : AsyncTask<Pair<ArrayList<FileDirItem>, FileDirItem>, Void, Boolean>() { listener: CopyMoveListener, val copyHidden: Boolean) : AsyncTask<Pair<ArrayList<FileDirItem>, String>, Void, Boolean>() { private val INITIAL_PROGRESS_DELAY = 3000L private val PROGRESS_RECHECK_INTERVAL = 500L Loading @@ -49,7 +49,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mNotificationBuilder = NotificationCompat.Builder(activity) } override fun doInBackground(vararg params: Pair<ArrayList<FileDirItem>, FileDirItem>): Boolean? { override fun doInBackground(vararg params: Pair<ArrayList<FileDirItem>, String>): Boolean? { if (params.isEmpty()) { return false } Loading @@ -60,7 +60,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mNotifId = (System.currentTimeMillis() / 1000).toInt() mMaxSize = 0 for (file in mFiles) { val newPath = "${pair.second!!.path}/${file.name}" val newPath = "${pair.second}/${file.name}" val fileExists = if (activity.isPathOnOTG(newPath)) activity.getFastDocumentFile(newPath)?.exists() ?: false else File(newPath).exists() if (getConflictResolution(newPath) != CONFLICT_SKIP || !fileExists) { Loading @@ -75,9 +75,9 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second!!.path}/${file.name}" val newPath = "${pair.second}/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) if (resolution == CONFLICT_SKIP) { mFileCountToCopy-- Loading Loading @@ -175,7 +175,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val children = activity.getDocumentFile(source.path)?.listFiles() ?: return for (child in children) { val newPath = "$destinationPath/${child.name}" if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { continue } Loading @@ -189,7 +189,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val children = File(source.path).list() for (child in children) { val newPath = "$destinationPath/$child" if (activity.doesFilePathExist(newPath)) { if (activity.getDoesFilePathExist(newPath)) { continue } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/FilePickerDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class FilePickerDialog(val activity: BaseSimpleActivity, private var mDialogView = activity.layoutInflater.inflate(R.layout.dialog_filepicker, null) init { if (!activity.doesFilePathExist(currPath)) { if (!activity.getDoesFilePathExist(currPath)) { currPath = activity.internalStoragePath } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/PropertiesDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class PropertiesDialog() { * @param countHiddenItems toggle determining if we will count hidden files themselves and their sizes (reasonable only at directory properties) */ constructor(activity: Activity, path: String, countHiddenItems: Boolean = false) : this() { if (!activity.doesFilePathExist(path)) { if (!activity.getDoesFilePathExist(path)) { activity.toast(String.format(activity.getString(R.string.source_file_doesnt_exist), path)) return } Loading