Fix `resizeImage()` threading issue
This commit is contained in:
parent
a1fca17516
commit
591e5f09e9
|
@ -67,7 +67,6 @@ class ResizeMultipleImagesDialog(
|
||||||
|
|
||||||
private fun resizeImages(factor: Float) {
|
private fun resizeImages(factor: Float) {
|
||||||
progressView.show()
|
progressView.show()
|
||||||
ensureBackgroundThread {
|
|
||||||
with(activity) {
|
with(activity) {
|
||||||
val newSizes = imageSizes.map {
|
val newSizes = imageSizes.map {
|
||||||
val width = (it.x * factor).roundToInt()
|
val width = (it.x * factor).roundToInt()
|
||||||
|
@ -79,6 +78,7 @@ class ResizeMultipleImagesDialog(
|
||||||
val pathsToRescan = arrayListOf<String>()
|
val pathsToRescan = arrayListOf<String>()
|
||||||
|
|
||||||
ensureWriteAccess(parentPath) {
|
ensureWriteAccess(parentPath) {
|
||||||
|
ensureBackgroundThread {
|
||||||
for (i in imagePaths.indices) {
|
for (i in imagePaths.indices) {
|
||||||
val path = imagePaths[i]
|
val path = imagePaths[i]
|
||||||
val size = newSizes[i]
|
val size = newSizes[i]
|
||||||
|
|
|
@ -823,7 +823,6 @@ fun BaseSimpleActivity.launchResizeImageDialog(path: String, callback: (() -> Un
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BaseSimpleActivity.resizeImage(path: String, size: Point, callback: (success: Boolean) -> Unit) {
|
fun BaseSimpleActivity.resizeImage(path: String, size: Point, callback: (success: Boolean) -> Unit) {
|
||||||
ensureBackgroundThread {
|
|
||||||
var oldExif: ExifInterface? = null
|
var oldExif: ExifInterface? = null
|
||||||
if (isNougatPlus()) {
|
if (isNougatPlus()) {
|
||||||
val inputStream = contentResolver.openInputStream(Uri.fromFile(File(path)))
|
val inputStream = contentResolver.openInputStream(Uri.fromFile(File(path)))
|
||||||
|
@ -853,7 +852,6 @@ fun BaseSimpleActivity.resizeImage(path: String, size: Point, callback: (success
|
||||||
callback(false)
|
callback(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BaseSimpleActivity.rescanPathsAndUpdateLastModified(paths: ArrayList<String>) {
|
fun BaseSimpleActivity.rescanPathsAndUpdateLastModified(paths: ArrayList<String>) {
|
||||||
|
|
Loading…
Reference in New Issue