try getting real filename from content uri at Edit Activity

This commit is contained in:
tibbi 2018-04-14 21:31:31 +02:00
parent 5e44ce356c
commit c0c7752f79

View file

@ -188,6 +188,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
} else if (saveUri.scheme == "content") {
var newPath = applicationContext.getRealPathFromURI(saveUri) ?: ""
var shouldAppendFilename = true
if (newPath.isEmpty()) {
newPath = applicationContext.getFilenameFromContentUri(saveUri) ?: ""
shouldAppendFilename = false
}
if (newPath.isEmpty()) {
newPath = "$internalStoragePath/${getCurrentFormattedDateTime()}.${saveUri.toString().getFilenameExtension()}"
shouldAppendFilename = false