mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-27 13:38:46 +02:00
show a toast if the title already exists, when opening a file
This commit is contained in:
parent
807b8409a0
commit
28ed5c654f
@ -165,12 +165,16 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
toast(R.string.file_too_large)
|
toast(R.string.file_too_large)
|
||||||
} else {
|
} else {
|
||||||
val filename = it.getFilenameFromPath()
|
val filename = it.getFilenameFromPath()
|
||||||
|
if (mDb.doesTitleExist(filename)) {
|
||||||
|
toast(R.string.title_taken)
|
||||||
|
} else {
|
||||||
val content = File(it).readText()
|
val content = File(it).readText()
|
||||||
val note = Note(0, filename, content, TYPE_NOTE)
|
val note = Note(0, filename, content, TYPE_NOTE)
|
||||||
addNewNote(note)
|
addNewNote(note)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun saveAsFile() {
|
private fun saveAsFile() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user