Do processing on background thread
This commit is contained in:
parent
ce898ba1cc
commit
726e7c1649
1 changed files with 14 additions and 10 deletions
|
@ -774,6 +774,7 @@ 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) {
|
||||||
|
ensureBackgroundThread {
|
||||||
val imagePaths = mutableListOf<String>()
|
val imagePaths = mutableListOf<String>()
|
||||||
val imageSizes = mutableListOf<Point>()
|
val imageSizes = mutableListOf<Point>()
|
||||||
for (path in paths) {
|
for (path in paths) {
|
||||||
|
@ -784,10 +785,13 @@ fun BaseSimpleActivity.launchResizeMultipleImagesDialog(paths: List<String>, cal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runOnUiThread {
|
||||||
ResizeMultipleImagesDialog(this, imagePaths, imageSizes) {
|
ResizeMultipleImagesDialog(this, imagePaths, imageSizes) {
|
||||||
callback?.invoke()
|
callback?.invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
fun BaseSimpleActivity.launchResizeImageDialog(path: String, callback: (() -> Unit)? = null) {
|
fun BaseSimpleActivity.launchResizeImageDialog(path: String, callback: (() -> Unit)? = null) {
|
||||||
|
|
Loading…
Reference in a new issue