add helper extension functions for scanning paths and files
This commit is contained in:
parent
7105afbaa4
commit
561b56d81e
2 changed files with 22 additions and 1 deletions
|
@ -6,7 +6,7 @@ buildscript {
|
|||
propMinSdkVersion = 16
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '3.8.1'
|
||||
propVersionName = '3.8.2'
|
||||
kotlin_version = '1.2.20'
|
||||
support_libs = '27.0.2'
|
||||
}
|
||||
|
|
|
@ -458,6 +458,27 @@ private fun deleteRecursively(file: File): Boolean {
|
|||
return file.delete()
|
||||
}
|
||||
|
||||
|
||||
fun Activity.scanFile(file: File, callback: (() -> Unit)? = null) {
|
||||
applicationContext.scanFile(file, callback)
|
||||
}
|
||||
|
||||
fun Activity.scanPath(path: String, callback: (() -> Unit)? = null) {
|
||||
applicationContext.scanPath(path, callback)
|
||||
}
|
||||
|
||||
fun Activity.scanFiles(files: ArrayList<File>, callback: (() -> Unit)? = null) {
|
||||
applicationContext.scanFiles(files, callback)
|
||||
}
|
||||
|
||||
fun Activity.scanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) {
|
||||
applicationContext.scanPaths(paths, callback)
|
||||
}
|
||||
|
||||
fun Activity.rescanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) {
|
||||
applicationContext.rescanPaths(paths, callback)
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
fun BaseSimpleActivity.renameFile(oldFile: File, newFile: File, callback: ((success: Boolean) -> Unit)? = null) {
|
||||
if (needsStupidWritePermissions(newFile.absolutePath)) {
|
||||
|
|
Loading…
Reference in a new issue