Do processing on background thread
This commit is contained in:
parent
ce898ba1cc
commit
726e7c1649
1 changed files with 14 additions and 10 deletions
|
@ -774,18 +774,22 @@ fun BaseSimpleActivity.ensureWriteAccess(path: String, callback: () -> Unit) {
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
fun BaseSimpleActivity.launchResizeMultipleImagesDialog(paths: List<String>, callback: (() -> Unit)? = null) {
|
fun BaseSimpleActivity.launchResizeMultipleImagesDialog(paths: List<String>, callback: (() -> Unit)? = null) {
|
||||||
val imagePaths = mutableListOf<String>()
|
ensureBackgroundThread {
|
||||||
val imageSizes = mutableListOf<Point>()
|
val imagePaths = mutableListOf<String>()
|
||||||
for (path in paths) {
|
val imageSizes = mutableListOf<Point>()
|
||||||
val size = path.getImageResolution(this)
|
for (path in paths) {
|
||||||
if (size != null) {
|
val size = path.getImageResolution(this)
|
||||||
imagePaths.add(path)
|
if (size != null) {
|
||||||
imageSizes.add(size)
|
imagePaths.add(path)
|
||||||
|
imageSizes.add(size)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ResizeMultipleImagesDialog(this, imagePaths, imageSizes) {
|
runOnUiThread {
|
||||||
callback?.invoke()
|
ResizeMultipleImagesDialog(this, imagePaths, imageSizes) {
|
||||||
|
callback?.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue