handle storage permission if saving a third party intent image

This commit is contained in:
tibbi 2018-01-23 22:58:09 +01:00
parent 76b85e611b
commit 15900f0506
1 changed files with 4 additions and 2 deletions

View File

@ -259,11 +259,13 @@ class MainActivity : SimpleActivity(), CanvasListener {
val outputStream = contentResolver.openOutputStream(intentUri)
saveToOutputStream(outputStream, file.getCompressionFormat())
} else {
handlePermission(PERMISSION_WRITE_STORAGE) {
getFileOutputStream(file) {
saveToOutputStream(it, file.getCompressionFormat())
}
}
}
}
private fun saveToOutputStream(outputStream: OutputStream?, format: Bitmap.CompressFormat) {
if (outputStream == null) {