fix #643, properly handle saving edited images with file uri

This commit is contained in:
tibbi 2018-02-08 21:11:22 +01:00
parent 316c8fc85d
commit a10fd3e876
1 changed files with 20 additions and 16 deletions

View File

@ -144,6 +144,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) {
if (result.error == null) { if (result.error == null) {
if (isCropIntent) { if (isCropIntent) {
if (saveUri.scheme == "file") {
saveBitmapToFile(result.bitmap, saveUri.path)
} else {
var inputStream: InputStream? = null var inputStream: InputStream? = null
var outputStream: OutputStream? = null var outputStream: OutputStream? = null
try { try {
@ -162,6 +165,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
setResult(RESULT_OK, this) setResult(RESULT_OK, this)
} }
finish() finish()
}
} else if (saveUri.scheme == "file") { } else if (saveUri.scheme == "file") {
SaveAsDialog(this, saveUri.path, true) { SaveAsDialog(this, saveUri.path, true) {
saveBitmapToFile(result.bitmap, it) saveBitmapToFile(result.bitmap, it)