Loading build.gradle +3 −3 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.0.21' kotlin_version = '1.2.41' propVersionName = '4.1.11' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading @@ -18,7 +18,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" Loading commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +10 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.annotation.TargetApi import android.app.Activity import android.app.ActivityManager import android.content.Context import android.content.Intent import android.graphics.BitmapFactory import android.graphics.drawable.ColorDrawable Loading Loading @@ -92,6 +93,14 @@ abstract class BaseSimpleActivity : AppCompatActivity() { else -> super.onOptionsItemSelected(item) } override fun attachBaseContext(newBase: Context) { if (newBase.baseConfig.useEnglish) { super.attachBaseContext(MyContextWrapper(newBase).wrap(newBase, "en")) } else { super.attachBaseContext(newBase) } } fun updateBackgroundColor(color: Int = baseConfig.backgroundColor) { window.decorView.setBackgroundColor(color) } Loading Loading @@ -265,13 +274,12 @@ abstract class BaseSimpleActivity : AppCompatActivity() { if (!baseConfig.keepLastModified) { newFile.setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldFileDirItem.path, newFile.absolutePath) updatedFiles.add(newFile.toFileDirItem(applicationContext)) } } val updatedPaths = updatedFiles.map { it.path } as ArrayList<String> scanPaths(updatedPaths) { scanPathsRecursively(updatedPaths) { runOnUiThread { copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size, destination) } Loading commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +2 −2 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal if (source.size == copiedSize) { mTransferredFiles.add(source) activity.scanPath(destination.path) { activity.scanPathRecursively(destination.path) { if (activity.baseConfig.keepLastModified) { copyOldLastModified(source.path, destination.path) } Loading Loading @@ -277,7 +277,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } selectionArgs = arrayOf(destinationPath) activity.scanPath(destinationPath) { activity.scanPathRecursively(destinationPath) { activity.applicationContext.contentResolver.update(uri, values, selection, selectionArgs) } } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +10 −10 Original line number Diff line number Diff line Loading @@ -488,20 +488,20 @@ private fun deleteRecursively(file: File): Boolean { return file.delete() } fun Activity.scanFile(file: File, callback: (() -> Unit)? = null) { applicationContext.scanFile(file, callback) fun Activity.scanFileRecursively(file: File, callback: (() -> Unit)? = null) { applicationContext.scanFileRecursively(file, callback) } fun Activity.scanPath(path: String, callback: (() -> Unit)? = null) { applicationContext.scanPath(path, callback) fun Activity.scanPathRecursively(path: String, callback: (() -> Unit)? = null) { applicationContext.scanPathRecursively(path, callback) } fun Activity.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { applicationContext.scanFiles(files, callback) fun Activity.scanFilesRecursively(files: ArrayList<File>, callback: (() -> Unit)? = null) { applicationContext.scanFilesRecursively(files, callback) } fun Activity.scanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { applicationContext.scanPaths(paths, callback) fun Activity.scanPathsRecursively(paths: ArrayList<String>, callback: (() -> Unit)? = null) { applicationContext.scanPathsRecursively(paths, callback) } fun Activity.rescanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { Loading Loading @@ -551,13 +551,13 @@ fun BaseSimpleActivity.renameFile(oldPath: String, newPath: String, callback: (( runOnUiThread { callback?.invoke(true) } scanPathRecursively(newPath) } } else { if (!baseConfig.keepLastModified) { File(newPath).setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldPath, newPath) scanPaths(arrayListOf(oldPath, newPath)) { scanPathsRecursively(arrayListOf(newPath)) { runOnUiThread { callback?.invoke(true) } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +7 −7 Original line number Diff line number Diff line Loading @@ -220,15 +220,15 @@ fun Context.getDocumentFile(path: String): DocumentFile? { fun Context.getSomeDocumentFile(path: String) = getFastDocumentFile(path) ?: getDocumentFile(path) fun Context.scanFile(file: File, callback: (() -> Unit)? = null) { scanFiles(arrayListOf(file), callback) fun Context.scanFileRecursively(file: File, callback: (() -> Unit)? = null) { scanFilesRecursively(arrayListOf(file), callback) } fun Context.scanPath(path: String, callback: (() -> Unit)? = null) { scanPaths(arrayListOf(path), callback) fun Context.scanPathRecursively(path: String, callback: (() -> Unit)? = null) { scanPathsRecursively(arrayListOf(path), callback) } fun Context.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { fun Context.scanFilesRecursively(files: ArrayList<File>, callback: (() -> Unit)? = null) { val allPaths = ArrayList<String>() for (file in files) { allPaths.addAll(getPaths(file)) Loading @@ -236,7 +236,7 @@ fun Context.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { rescanPaths(allPaths, callback) } fun Context.scanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { fun Context.scanPathsRecursively(paths: ArrayList<String>, callback: (() -> Unit)? = null) { val allPaths = ArrayList<String>() for (path in paths) { allPaths.addAll(getPaths(File(path))) Loading Loading @@ -270,7 +270,7 @@ fun Context.getFileUri(path: String) = when { else -> MediaStore.Files.getContentUri("external") } // these functions update the mediastore instantly, MediaScannerConnection.scanFile takes some time to really get applied // these functions update the mediastore instantly, MediaScannerConnection.scanFileRecursively takes some time to really get applied fun Context.deleteFromMediaStore(path: String): Boolean { if (getDoesFilePathExist(path) || getIsPathDirectory(path)) { return false Loading Loading
build.gradle +3 −3 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.0.21' kotlin_version = '1.2.41' propVersionName = '4.1.11' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading @@ -18,7 +18,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" Loading
commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +10 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.annotation.TargetApi import android.app.Activity import android.app.ActivityManager import android.content.Context import android.content.Intent import android.graphics.BitmapFactory import android.graphics.drawable.ColorDrawable Loading Loading @@ -92,6 +93,14 @@ abstract class BaseSimpleActivity : AppCompatActivity() { else -> super.onOptionsItemSelected(item) } override fun attachBaseContext(newBase: Context) { if (newBase.baseConfig.useEnglish) { super.attachBaseContext(MyContextWrapper(newBase).wrap(newBase, "en")) } else { super.attachBaseContext(newBase) } } fun updateBackgroundColor(color: Int = baseConfig.backgroundColor) { window.decorView.setBackgroundColor(color) } Loading Loading @@ -265,13 +274,12 @@ abstract class BaseSimpleActivity : AppCompatActivity() { if (!baseConfig.keepLastModified) { newFile.setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldFileDirItem.path, newFile.absolutePath) updatedFiles.add(newFile.toFileDirItem(applicationContext)) } } val updatedPaths = updatedFiles.map { it.path } as ArrayList<String> scanPaths(updatedPaths) { scanPathsRecursively(updatedPaths) { runOnUiThread { copyMoveListener.copySucceeded(false, fileDirItems.size * 2 == updatedFiles.size, destination) } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +2 −2 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal if (source.size == copiedSize) { mTransferredFiles.add(source) activity.scanPath(destination.path) { activity.scanPathRecursively(destination.path) { if (activity.baseConfig.keepLastModified) { copyOldLastModified(source.path, destination.path) } Loading Loading @@ -277,7 +277,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal } selectionArgs = arrayOf(destinationPath) activity.scanPath(destinationPath) { activity.scanPathRecursively(destinationPath) { activity.applicationContext.contentResolver.update(uri, values, selection, selectionArgs) } } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +10 −10 Original line number Diff line number Diff line Loading @@ -488,20 +488,20 @@ private fun deleteRecursively(file: File): Boolean { return file.delete() } fun Activity.scanFile(file: File, callback: (() -> Unit)? = null) { applicationContext.scanFile(file, callback) fun Activity.scanFileRecursively(file: File, callback: (() -> Unit)? = null) { applicationContext.scanFileRecursively(file, callback) } fun Activity.scanPath(path: String, callback: (() -> Unit)? = null) { applicationContext.scanPath(path, callback) fun Activity.scanPathRecursively(path: String, callback: (() -> Unit)? = null) { applicationContext.scanPathRecursively(path, callback) } fun Activity.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { applicationContext.scanFiles(files, callback) fun Activity.scanFilesRecursively(files: ArrayList<File>, callback: (() -> Unit)? = null) { applicationContext.scanFilesRecursively(files, callback) } fun Activity.scanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { applicationContext.scanPaths(paths, callback) fun Activity.scanPathsRecursively(paths: ArrayList<String>, callback: (() -> Unit)? = null) { applicationContext.scanPathsRecursively(paths, callback) } fun Activity.rescanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { Loading Loading @@ -551,13 +551,13 @@ fun BaseSimpleActivity.renameFile(oldPath: String, newPath: String, callback: (( runOnUiThread { callback?.invoke(true) } scanPathRecursively(newPath) } } else { if (!baseConfig.keepLastModified) { File(newPath).setLastModified(System.currentTimeMillis()) } updateInMediaStore(oldPath, newPath) scanPaths(arrayListOf(oldPath, newPath)) { scanPathsRecursively(arrayListOf(newPath)) { runOnUiThread { callback?.invoke(true) } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +7 −7 Original line number Diff line number Diff line Loading @@ -220,15 +220,15 @@ fun Context.getDocumentFile(path: String): DocumentFile? { fun Context.getSomeDocumentFile(path: String) = getFastDocumentFile(path) ?: getDocumentFile(path) fun Context.scanFile(file: File, callback: (() -> Unit)? = null) { scanFiles(arrayListOf(file), callback) fun Context.scanFileRecursively(file: File, callback: (() -> Unit)? = null) { scanFilesRecursively(arrayListOf(file), callback) } fun Context.scanPath(path: String, callback: (() -> Unit)? = null) { scanPaths(arrayListOf(path), callback) fun Context.scanPathRecursively(path: String, callback: (() -> Unit)? = null) { scanPathsRecursively(arrayListOf(path), callback) } fun Context.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { fun Context.scanFilesRecursively(files: ArrayList<File>, callback: (() -> Unit)? = null) { val allPaths = ArrayList<String>() for (file in files) { allPaths.addAll(getPaths(file)) Loading @@ -236,7 +236,7 @@ fun Context.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) { rescanPaths(allPaths, callback) } fun Context.scanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) { fun Context.scanPathsRecursively(paths: ArrayList<String>, callback: (() -> Unit)? = null) { val allPaths = ArrayList<String>() for (path in paths) { allPaths.addAll(getPaths(File(path))) Loading Loading @@ -270,7 +270,7 @@ fun Context.getFileUri(path: String) = when { else -> MediaStore.Files.getContentUri("external") } // these functions update the mediastore instantly, MediaScannerConnection.scanFile takes some time to really get applied // these functions update the mediastore instantly, MediaScannerConnection.scanFileRecursively takes some time to really get applied fun Context.deleteFromMediaStore(path: String): Boolean { if (getDoesFilePathExist(path) || getIsPathDirectory(path)) { return false Loading