Fixed missing permission for rotate on external memory (#2236)
This commit is contained in:
parent
e849c6f7c0
commit
57020626db
1 changed files with 25 additions and 13 deletions
|
@ -308,24 +308,36 @@ class MediaAdapter(
|
|||
}
|
||||
|
||||
private fun rotateSelection(degrees: Int) {
|
||||
activity.toast(R.string.saving)
|
||||
ensureBackgroundThread {
|
||||
val paths = getSelectedPaths().filter { it.isImageFast() }
|
||||
var fileCnt = paths.size
|
||||
rotatedImagePaths.clear()
|
||||
paths.forEach {
|
||||
rotatedImagePaths.add(it)
|
||||
activity.saveRotatedImageToFile(it, it, degrees, true) {
|
||||
fileCnt--
|
||||
if (fileCnt == 0) {
|
||||
activity.runOnUiThread {
|
||||
listener?.refreshItems()
|
||||
finishActMode()
|
||||
val paths = getSelectedPaths().filter { it.isImageFast() }
|
||||
var fileCnt = paths.size
|
||||
rotatedImagePaths.clear()
|
||||
val handleRotate = {
|
||||
activity.toast(R.string.saving)
|
||||
ensureBackgroundThread {
|
||||
paths.forEach {
|
||||
rotatedImagePaths.add(it)
|
||||
activity.saveRotatedImageToFile(it, it, degrees, true) {
|
||||
fileCnt--
|
||||
if (fileCnt == 0) {
|
||||
activity.runOnUiThread {
|
||||
listener?.refreshItems()
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (paths.any { activity.needsStupidWritePermissions(it) }) {
|
||||
activity.handleSAFDialog(paths.first { activity.needsStupidWritePermissions(it) }) {
|
||||
if (it) {
|
||||
handleRotate()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
handleRotate()
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveFilesTo() {
|
||||
|
|
Loading…
Reference in a new issue