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.11.46' propVersionName = '3.11.47' kotlin_version = '1.2.21' support_libs = '27.0.2' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ open class BaseSimpleActivity : AppCompatActivity() { newFile.setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldFileDirItem.path, newFile.absolutePath) updatedFiles.add(newFile.toFileDirItem()) updatedFiles.add(newFile.toFileDirItem(applicationContext)) } } Loading commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +14 −11 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private val PROGRESS_RECHECK_INTERVAL = 500L private var mListener: WeakReference<CopyMoveListener>? = null private var mMovedFiles = ArrayList<FileDirItem>() private var mTransferredFiles = ArrayList<FileDirItem>() private var mDocuments = LinkedHashMap<String, DocumentFile?>() private var mFiles = ArrayList<FileDirItem>() private var mFileCountToCopy = 0 Loading Loading @@ -76,7 +76,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second!!.path}/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath()) val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.doesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) if (resolution == CONFLICT_SKIP) { Loading @@ -96,7 +96,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } if (!copyOnly) { activity.deleteFiles(mMovedFiles) {} activity.deleteFiles(mTransferredFiles) {} } val paths = mFiles.map { it.path } as ArrayList<String> Loading @@ -110,7 +110,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val listener = mListener?.get() ?: return if (success) { listener.copySucceeded(copyOnly, mMovedFiles.size >= mFileCountToCopy) listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy) } else { listener.copyFailed() } Loading Loading @@ -172,10 +172,10 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } if (activity.isPathOnOTG(source.path)) { val children = activity.getSomeDocumentFile(source.path)?.listFiles() ?: return val children = activity.getDocumentFile(source.path)?.listFiles() ?: return for (child in children) { val newPath = "$destinationPath/${child.name}" if (activity.getFastDocumentFile(newPath)?.exists() == true) { if (activity.doesFilePathExist(newPath)) { continue } Loading @@ -184,18 +184,21 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val newFileDirItem = FileDirItem(newPath, child.name, child.isDirectory) copy(oldFileDirItem, newFileDirItem) } mTransferredFiles.add(source) } else { val children = File(source.path).list() for (child in children) { val newFile = File(destinationPath, child) if (newFile.exists()) { val newPath = "$destinationPath/$child" if (activity.doesFilePathExist(newPath)) { continue } val oldFile = File(source.path, child) copy(oldFile.toFileDirItem(), newFile.toFileDirItem()) val oldFileDirItem = oldFile.toFileDirItem(activity.applicationContext) val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), oldFile.isDirectory) copy(oldFileDirItem, newFileDirItem) } mMovedFiles.add(source) mTransferredFiles.add(source) } } Loading Loading @@ -234,7 +237,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mCurrentProgress += copiedSize if (source.size == copiedSize) { mMovedFiles.add(source) mTransferredFiles.add(source) if (activity.baseConfig.keepLastModified) { copyOldLastModified(source.path, destination.path) } else { Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +3 −3 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ fun BaseSimpleActivity.deleteFolderBg(fileDirItem: FileDirItem, deleteMediaOnly: val filesList = (filesArr as Array).toList() val files = filesList.filter { !deleteMediaOnly || it.isImageVideoGif() } for (file in files) { deleteFileBg(file.toFileDirItem(), false) { } deleteFileBg(file.toFileDirItem(applicationContext), false) { } } if (folder.listFiles()?.isEmpty() == true) { Loading Loading @@ -589,12 +589,12 @@ fun Activity.handleAppPasswordProtection(callback: (success: Boolean) -> Unit) { } fun BaseSimpleActivity.createDirectorySync(directory: String): Boolean { if (File(directory).exists()) { if (doesFilePathExist(directory)) { return true } if (needsStupidWritePermissions(directory)) { val documentFile = getDocumentFile(directory) ?: return false val documentFile = getDocumentFile(directory.getParentPath()) ?: return false val newDir = documentFile.createDirectory(directory.getFilenameFromPath()) return newDir != null } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt +2 −1 Original line number Diff line number Diff line package com.simplemobiletools.commons.extensions import android.content.Context import android.graphics.Bitmap import android.graphics.BitmapFactory import android.graphics.Point Loading Loading @@ -150,4 +151,4 @@ private fun getDirectoryFileCount(dir: File, countHiddenItems: Boolean): Int { return count } fun File.toFileDirItem() = FileDirItem(absolutePath, name, isDirectory, 0, 0L) fun File.toFileDirItem(context: Context) = FileDirItem(absolutePath, name, absolutePath.getIsDirectory(context), 0, 0L) 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.11.46' propVersionName = '3.11.47' kotlin_version = '1.2.21' support_libs = '27.0.2' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ open class BaseSimpleActivity : AppCompatActivity() { newFile.setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldFileDirItem.path, newFile.absolutePath) updatedFiles.add(newFile.toFileDirItem()) updatedFiles.add(newFile.toFileDirItem(applicationContext)) } } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +14 −11 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private val PROGRESS_RECHECK_INTERVAL = 500L private var mListener: WeakReference<CopyMoveListener>? = null private var mMovedFiles = ArrayList<FileDirItem>() private var mTransferredFiles = ArrayList<FileDirItem>() private var mDocuments = LinkedHashMap<String, DocumentFile?>() private var mFiles = ArrayList<FileDirItem>() private var mFileCountToCopy = 0 Loading Loading @@ -76,7 +76,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal for (file in mFiles) { try { val newPath = "${pair.second!!.path}/${file.name}" val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath()) val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), file.isDirectory) if (activity.doesFilePathExist(newPath)) { val resolution = getConflictResolution(newPath) if (resolution == CONFLICT_SKIP) { Loading @@ -96,7 +96,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } if (!copyOnly) { activity.deleteFiles(mMovedFiles) {} activity.deleteFiles(mTransferredFiles) {} } val paths = mFiles.map { it.path } as ArrayList<String> Loading @@ -110,7 +110,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val listener = mListener?.get() ?: return if (success) { listener.copySucceeded(copyOnly, mMovedFiles.size >= mFileCountToCopy) listener.copySucceeded(copyOnly, mTransferredFiles.size >= mFileCountToCopy) } else { listener.copyFailed() } Loading Loading @@ -172,10 +172,10 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } if (activity.isPathOnOTG(source.path)) { val children = activity.getSomeDocumentFile(source.path)?.listFiles() ?: return val children = activity.getDocumentFile(source.path)?.listFiles() ?: return for (child in children) { val newPath = "$destinationPath/${child.name}" if (activity.getFastDocumentFile(newPath)?.exists() == true) { if (activity.doesFilePathExist(newPath)) { continue } Loading @@ -184,18 +184,21 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal val newFileDirItem = FileDirItem(newPath, child.name, child.isDirectory) copy(oldFileDirItem, newFileDirItem) } mTransferredFiles.add(source) } else { val children = File(source.path).list() for (child in children) { val newFile = File(destinationPath, child) if (newFile.exists()) { val newPath = "$destinationPath/$child" if (activity.doesFilePathExist(newPath)) { continue } val oldFile = File(source.path, child) copy(oldFile.toFileDirItem(), newFile.toFileDirItem()) val oldFileDirItem = oldFile.toFileDirItem(activity.applicationContext) val newFileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), oldFile.isDirectory) copy(oldFileDirItem, newFileDirItem) } mMovedFiles.add(source) mTransferredFiles.add(source) } } Loading Loading @@ -234,7 +237,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal mCurrentProgress += copiedSize if (source.size == copiedSize) { mMovedFiles.add(source) mTransferredFiles.add(source) if (activity.baseConfig.keepLastModified) { copyOldLastModified(source.path, destination.path) } else { Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +3 −3 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ fun BaseSimpleActivity.deleteFolderBg(fileDirItem: FileDirItem, deleteMediaOnly: val filesList = (filesArr as Array).toList() val files = filesList.filter { !deleteMediaOnly || it.isImageVideoGif() } for (file in files) { deleteFileBg(file.toFileDirItem(), false) { } deleteFileBg(file.toFileDirItem(applicationContext), false) { } } if (folder.listFiles()?.isEmpty() == true) { Loading Loading @@ -589,12 +589,12 @@ fun Activity.handleAppPasswordProtection(callback: (success: Boolean) -> Unit) { } fun BaseSimpleActivity.createDirectorySync(directory: String): Boolean { if (File(directory).exists()) { if (doesFilePathExist(directory)) { return true } if (needsStupidWritePermissions(directory)) { val documentFile = getDocumentFile(directory) ?: return false val documentFile = getDocumentFile(directory.getParentPath()) ?: return false val newDir = documentFile.createDirectory(directory.getFilenameFromPath()) return newDir != null } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt +2 −1 Original line number Diff line number Diff line package com.simplemobiletools.commons.extensions import android.content.Context import android.graphics.Bitmap import android.graphics.BitmapFactory import android.graphics.Point Loading Loading @@ -150,4 +151,4 @@ private fun getDirectoryFileCount(dir: File, countHiddenItems: Boolean): Int { return count } fun File.toFileDirItem() = FileDirItem(absolutePath, name, isDirectory, 0, 0L) fun File.toFileDirItem(context: Context) = FileDirItem(absolutePath, name, absolutePath.getIsDirectory(context), 0, 0L)