mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
ensure decompression is in background thread
This commit is contained in:
@@ -505,15 +505,17 @@ class ItemsAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList()
|
val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList()
|
||||||
tryDecompressingPaths(paths) {
|
ensureBackgroundThread {
|
||||||
if (it) {
|
tryDecompressingPaths(paths) { success ->
|
||||||
activity.toast(R.string.decompression_successful)
|
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
listener?.refreshFragment()
|
if (success) {
|
||||||
finishActMode()
|
activity.toast(R.string.decompression_successful)
|
||||||
|
listener?.refreshFragment()
|
||||||
|
finishActMode()
|
||||||
|
} else {
|
||||||
|
activity.toast(R.string.decompressing_failed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
activity.toast(R.string.decompressing_failed)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,7 +542,6 @@ class ItemsAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
exception.printStackTrace()
|
|
||||||
activity.showErrorToast(exception)
|
activity.showErrorToast(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,7 +590,6 @@ class ItemsAdapter(
|
|||||||
}
|
}
|
||||||
callback(true)
|
callback(true)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
callback(false)
|
callback(false)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user