shortening some code

This commit is contained in:
tibbi 2021-03-21 11:20:57 +01:00
parent f3b14460df
commit 386767bd6f
1 changed files with 4 additions and 6 deletions

View File

@ -610,12 +610,10 @@ class MainActivity : SimpleActivity() {
}
private fun addNoteFromUri(uri: Uri, filename: String? = null) {
val noteTitle = if (filename?.isEmpty() == false) {
filename
} else if (uri.toString().startsWith("content://")) {
getFilenameFromContentUri(uri) ?: getNewNoteTitle()
} else {
getNewNoteTitle()
val noteTitle = when {
filename?.isEmpty() == false -> filename
uri.toString().startsWith("content://") -> getFilenameFromContentUri(uri) ?: getNewNoteTitle()
else -> getNewNoteTitle()
}
val inputStream = contentResolver.openInputStream(uri)