Moved handleRotate to the separate method

This commit is contained in:
Agnieszka C 2021-11-30 15:55:10 +01:00
parent 57020626db
commit 1f47af7826
1 changed files with 17 additions and 16 deletions

View File

@ -307,11 +307,9 @@ class MediaAdapter(
}
}
private fun rotateSelection(degrees: Int) {
val paths = getSelectedPaths().filter { it.isImageFast() }
private fun handleRotate(paths: List<String>, degrees: Int) {
var fileCnt = paths.size
rotatedImagePaths.clear()
val handleRotate = {
activity.toast(R.string.saving)
ensureBackgroundThread {
paths.forEach {
@ -329,14 +327,17 @@ class MediaAdapter(
}
}
private fun rotateSelection(degrees: Int) {
val paths = getSelectedPaths().filter { it.isImageFast() }
if (paths.any { activity.needsStupidWritePermissions(it) }) {
activity.handleSAFDialog(paths.first { activity.needsStupidWritePermissions(it) }) {
if (it) {
handleRotate()
handleRotate(paths, degrees)
}
}
} else {
handleRotate()
handleRotate(paths, degrees)
}
}