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.16.1' propVersionName = '3.16.11' kotlin_version = '1.2.30' support_libs = '27.1.0' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +5 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import java.io.File import java.util.* open class BaseSimpleActivity : AppCompatActivity() { var copyMoveCallback: (() -> Unit)? = null var copyMoveCallback: ((destinationPath: String) -> Unit)? = null var actionOnPermission: ((granted: Boolean) -> Unit)? = null var isAskingPermissions = false var useDynamicTheme = true Loading Loading @@ -190,7 +190,7 @@ open class BaseSimpleActivity : AppCompatActivity() { } fun copyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>, source: String, destination: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean, callback: () -> Unit) { copyHidden: Boolean, callback: (destinationPath: String) -> Unit) { if (source == destination) { toast(R.string.source_and_destination_same) return Loading Loading @@ -230,7 +230,7 @@ open class BaseSimpleActivity : AppCompatActivity() { val updatedPaths = updatedFiles.map { it.path } as ArrayList<String> scanPaths(updatedPaths) { runOnUiThread { copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size) copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size, destination) } } } catch (e: Exception) { Loading Loading @@ -294,13 +294,13 @@ open class BaseSimpleActivity : AppCompatActivity() { } val copyMoveListener = object : CopyMoveListener { override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean) { override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean, destinationPath: String) { if (copyOnly) { toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial) } else { toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial) } copyMoveCallback?.invoke() copyMoveCallback?.invoke(destinationPath) copyMoveCallback = null } Loading commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +5 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private var mDocuments = LinkedHashMap<String, DocumentFile?>() private var mFiles = ArrayList<FileDirItem>() private var mFileCountToCopy = 0 private var mDestinationPath = "" // progress indication private var mNotificationManager: NotificationManager Loading @@ -58,6 +59,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val pair = params[0] mFiles = pair.first!! mDestinationPath = pair.second!! mFileCountToCopy = mFiles.size mNotifId = (System.currentTimeMillis() / 1000).toInt() mMaxSize = 0 Loading @@ -65,7 +67,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal if (file.size == 0L) { file.size = file.getProperSize(activity, copyHidden) } val newPath = "${pair.second}/${file.name}" val newPath = "$mDestinationPath/${file.name}" val fileExists = if (newPath.startsWith(OTG_PATH)) activity.getFastDocumentFile(newPath)?.exists() ?: false else File(newPath).exists() if (getConflictResolution(newPath) != CONFLICT_SKIP || !fileExists) { Loading @@ -80,7 +82,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second}/${file.name}" val newPath = "$mDestinationPath/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.getDoesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) Loading Loading @@ -113,7 +115,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val listener = mListener?.get() ?: return if (success) { listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy) listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy, mDestinationPath) } else { listener.copyFailed() } Loading commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/RenameItemDialog.kt +1 −3 Original line number Diff line number Diff line Loading @@ -67,9 +67,7 @@ class RenameItemDialog(val activity: BaseSimpleActivity, val path: String, val c updatedPaths.add(newPath) activity.renameFile(path, newPath) { if (it) { activity.scanPaths(updatedPaths) { callback(newPath) } dismiss() } else { activity.toast(R.string.unknown_error_occurred) Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +6 −1 Original line number Diff line number Diff line Loading @@ -595,8 +595,13 @@ fun BaseSimpleActivity.getFileOutputStream(fileDirItem: FileDirItem, allowCreati } } } else { val file = File(fileDirItem.path) if (!file.parentFile.exists()) { file.parentFile.mkdirs() } try { callback(FileOutputStream(File(fileDirItem.path))) callback(FileOutputStream(file)) } catch (e: Exception) { callback(null) } 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.16.1' propVersionName = '3.16.11' kotlin_version = '1.2.30' support_libs = '27.1.0' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +5 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import java.io.File import java.util.* open class BaseSimpleActivity : AppCompatActivity() { var copyMoveCallback: (() -> Unit)? = null var copyMoveCallback: ((destinationPath: String) -> Unit)? = null var actionOnPermission: ((granted: Boolean) -> Unit)? = null var isAskingPermissions = false var useDynamicTheme = true Loading Loading @@ -190,7 +190,7 @@ open class BaseSimpleActivity : AppCompatActivity() { } fun copyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>, source: String, destination: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean, callback: () -> Unit) { copyHidden: Boolean, callback: (destinationPath: String) -> Unit) { if (source == destination) { toast(R.string.source_and_destination_same) return Loading Loading @@ -230,7 +230,7 @@ open class BaseSimpleActivity : AppCompatActivity() { val updatedPaths = updatedFiles.map { it.path } as ArrayList<String> scanPaths(updatedPaths) { runOnUiThread { copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size) copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size, destination) } } } catch (e: Exception) { Loading Loading @@ -294,13 +294,13 @@ open class BaseSimpleActivity : AppCompatActivity() { } val copyMoveListener = object : CopyMoveListener { override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean) { override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean, destinationPath: String) { if (copyOnly) { toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial) } else { toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial) } copyMoveCallback?.invoke() copyMoveCallback?.invoke(destinationPath) copyMoveCallback = null } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +5 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private var mDocuments = LinkedHashMap<String, DocumentFile?>() private var mFiles = ArrayList<FileDirItem>() private var mFileCountToCopy = 0 private var mDestinationPath = "" // progress indication private var mNotificationManager: NotificationManager Loading @@ -58,6 +59,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val pair = params[0] mFiles = pair.first!! mDestinationPath = pair.second!! mFileCountToCopy = mFiles.size mNotifId = (System.currentTimeMillis() / 1000).toInt() mMaxSize = 0 Loading @@ -65,7 +67,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal if (file.size == 0L) { file.size = file.getProperSize(activity, copyHidden) } val newPath = "${pair.second}/${file.name}" val newPath = "$mDestinationPath/${file.name}" val fileExists = if (newPath.startsWith(OTG_PATH)) activity.getFastDocumentFile(newPath)?.exists() ?: false else File(newPath).exists() if (getConflictResolution(newPath) != CONFLICT_SKIP || !fileExists) { Loading @@ -80,7 +82,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second}/${file.name}" val newPath = "$mDestinationPath/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.getDoesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) Loading Loading @@ -113,7 +115,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val listener = mListener?.get() ?: return if (success) { listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy) listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy, mDestinationPath) } else { listener.copyFailed() } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/dialogs/RenameItemDialog.kt +1 −3 Original line number Diff line number Diff line Loading @@ -67,9 +67,7 @@ class RenameItemDialog(val activity: BaseSimpleActivity, val path: String, val c updatedPaths.add(newPath) activity.renameFile(path, newPath) { if (it) { activity.scanPaths(updatedPaths) { callback(newPath) } dismiss() } else { activity.toast(R.string.unknown_error_occurred) Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +6 −1 Original line number Diff line number Diff line Loading @@ -595,8 +595,13 @@ fun BaseSimpleActivity.getFileOutputStream(fileDirItem: FileDirItem, allowCreati } } } else { val file = File(fileDirItem.path) if (!file.parentFile.exists()) { file.parentFile.mkdirs() } try { callback(FileOutputStream(File(fileDirItem.path))) callback(FileOutputStream(file)) } catch (e: Exception) { callback(null) } Loading