Moved handleRotate to the separate method
This commit is contained in:
parent
57020626db
commit
1f47af7826
1 changed files with 17 additions and 16 deletions
|
@ -307,36 +307,37 @@ class MediaAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rotateSelection(degrees: Int) {
|
private fun handleRotate(paths: List<String>, degrees: Int) {
|
||||||
val paths = getSelectedPaths().filter { it.isImageFast() }
|
|
||||||
var fileCnt = paths.size
|
var fileCnt = paths.size
|
||||||
rotatedImagePaths.clear()
|
rotatedImagePaths.clear()
|
||||||
val handleRotate = {
|
activity.toast(R.string.saving)
|
||||||
activity.toast(R.string.saving)
|
ensureBackgroundThread {
|
||||||
ensureBackgroundThread {
|
paths.forEach {
|
||||||
paths.forEach {
|
rotatedImagePaths.add(it)
|
||||||
rotatedImagePaths.add(it)
|
activity.saveRotatedImageToFile(it, it, degrees, true) {
|
||||||
activity.saveRotatedImageToFile(it, it, degrees, true) {
|
fileCnt--
|
||||||
fileCnt--
|
if (fileCnt == 0) {
|
||||||
if (fileCnt == 0) {
|
activity.runOnUiThread {
|
||||||
activity.runOnUiThread {
|
listener?.refreshItems()
|
||||||
listener?.refreshItems()
|
finishActMode()
|
||||||
finishActMode()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun rotateSelection(degrees: Int) {
|
||||||
|
val paths = getSelectedPaths().filter { it.isImageFast() }
|
||||||
|
|
||||||
if (paths.any { activity.needsStupidWritePermissions(it) }) {
|
if (paths.any { activity.needsStupidWritePermissions(it) }) {
|
||||||
activity.handleSAFDialog(paths.first { activity.needsStupidWritePermissions(it) }) {
|
activity.handleSAFDialog(paths.first { activity.needsStupidWritePermissions(it) }) {
|
||||||
if (it) {
|
if (it) {
|
||||||
handleRotate()
|
handleRotate(paths, degrees)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handleRotate()
|
handleRotate(paths, degrees)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue