tweaking some uri permissions

This commit is contained in:
tibbi 2017-12-22 15:31:13 +01:00
parent cdd9dcbae7
commit 597e62b7a1
2 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.gallery.activities
import android.app.Activity
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.Bitmap.CompressFormat
import android.graphics.Point
@ -143,7 +144,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
inputStream?.close()
outputStream?.close()
}
setResult(RESULT_OK)
Intent().apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
setResult(RESULT_OK, this)
}
finish()
} else if (saveUri.scheme == "file") {
SaveAsDialog(this, saveUri.path, true) {

View file

@ -486,7 +486,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
clipData.addItem(ClipData.Item(it))
}
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
resultIntent.clipData = clipData
}
@ -495,7 +495,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID)
val type = path.getMimeTypeFromPath()
resultIntent.setDataAndTypeAndNormalize(uri, type)
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
private fun itemClicked(path: String) {