Merge pull request #2257 from Aga-C/add-rotate-permission

Fixed missing permission for rotate on external memory (#2236)
This commit is contained in:
Tibor Kaputa 2021-12-01 10:29:31 +01:00 committed by GitHub
commit aea7252b16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -311,12 +311,11 @@ class MediaAdapter(
}
}
private fun rotateSelection(degrees: Int) {
activity.toast(R.string.saving)
ensureBackgroundThread {
val paths = getSelectedPaths().filter { it.isImageFast() }
private fun handleRotate(paths: List<String>, degrees: Int) {
var fileCnt = paths.size
rotatedImagePaths.clear()
activity.toast(R.string.saving)
ensureBackgroundThread {
paths.forEach {
rotatedImagePaths.add(it)
activity.saveRotatedImageToFile(it, it, degrees, true) {
@ -332,6 +331,20 @@ 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(paths, degrees)
}
}
} else {
handleRotate(paths, degrees)
}
}
private fun moveFilesTo() {
activity.handleDeletePasswordProtection {
copyMoveTo(false)