mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
Always request write permission when updating existing file on 30+
A casual file output stream was needed to fix the file size update issue
This commit is contained in:
parent
89a8902bc4
commit
2131cb79d3
2 changed files with 11 additions and 9 deletions
|
@ -873,6 +873,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val file = File(path)
|
val file = File(path)
|
||||||
val fileDirItem = FileDirItem(path, path.getFilenameFromPath())
|
val fileDirItem = FileDirItem(path, path.getFilenameFromPath())
|
||||||
|
try {
|
||||||
|
val out = FileOutputStream(file)
|
||||||
|
saveBitmap(file, bitmap, out, showSavingToast)
|
||||||
|
} catch (e: Exception) {
|
||||||
getFileOutputStream(fileDirItem, true) {
|
getFileOutputStream(fileDirItem, true) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
saveBitmap(file, bitmap, it, showSavingToast)
|
saveBitmap(file, bitmap, it, showSavingToast)
|
||||||
|
@ -881,6 +885,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
} catch (e: OutOfMemoryError) {
|
} catch (e: OutOfMemoryError) {
|
||||||
|
|
|
@ -78,10 +78,7 @@ class SaveAsDialog(
|
||||||
if (activity.getDoesFilePathExist(newPath)) {
|
if (activity.getDoesFilePathExist(newPath)) {
|
||||||
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename)
|
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename)
|
||||||
ConfirmationDialog(activity, title) {
|
ConfirmationDialog(activity, title) {
|
||||||
val newFile = File(newPath)
|
if ((isRPlus() && !isExternalStorageManager())) {
|
||||||
val isInDownloadDir = activity.isInDownloadDir(newPath)
|
|
||||||
val isInSubFolderInDownloadDir = activity.isInSubFolderInDownloadDir(newPath)
|
|
||||||
if ((isRPlus() && !isExternalStorageManager()) && isInDownloadDir && !isInSubFolderInDownloadDir && !newFile.canWrite()) {
|
|
||||||
val fileDirItem = arrayListOf(File(newPath).toFileDirItem(activity))
|
val fileDirItem = arrayListOf(File(newPath).toFileDirItem(activity))
|
||||||
val fileUris = activity.getFileUrisFromFileDirItems(fileDirItem)
|
val fileUris = activity.getFileUrisFromFileDirItems(fileDirItem)
|
||||||
activity.updateSDK30Uris(fileUris) { success ->
|
activity.updateSDK30Uris(fileUris) { success ->
|
||||||
|
|
Loading…
Reference in a new issue