moving another function in Room

This commit is contained in:
tibbi
2018-11-07 20:39:17 +01:00
parent 43896a964a
commit 66821397e9
6 changed files with 75 additions and 72 deletions

View File

@ -300,7 +300,7 @@ class MainActivity : SimpleActivity() {
}
private fun displayNewNoteDialog(value: String = "") {
NewNoteDialog(this, dbHelper) {
NewNoteDialog(this) {
val newNote = Note(null, it, value, TYPE_NOTE)
addNewNote(newNote)
}
@ -355,7 +355,7 @@ class MainActivity : SimpleActivity() {
toast(R.string.invalid_file_format)
} else if (file.length() > 10 * 1000 * 1000) {
toast(R.string.file_too_large)
} else if (checkTitle && dbHelper.doesNoteTitleExist(path.getFilenameFromPath())) {
} else if (checkTitle && mNotes.any { it.title.equals(path.getFilenameFromPath(), true) }) {
toast(R.string.title_taken)
} else {
onChecksPassed(file)
@ -386,7 +386,7 @@ class MainActivity : SimpleActivity() {
private fun openPath(path: String) {
openFile(path, false) {
var title = path.getFilenameFromPath()
if (dbHelper.doesNoteTitleExist(title)) {
if (mNotes.any { it.title.equals(title, true) }) {
title += " (file)"
}