Skip to content

Commit 045985d

Browse files
committed
Add names to call arguments
1 parent 308479d commit 045985d

File tree

1 file changed

+62
-35
lines changed

1 file changed

+62
-35
lines changed

app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -473,27 +473,29 @@ class MainActivity : SimpleActivity() {
473473
val file = File(realPath)
474474
handleUri(Uri.fromFile(file))
475475
} else if (intent.getBooleanExtra(NEW_TEXT_NOTE, false)) {
476-
val newTextNote = Note(
477-
null,
478-
getCurrentFormattedDateTime(),
479-
"",
480-
NoteType.TYPE_TEXT,
481-
"",
482-
PROTECTION_NONE,
483-
""
476+
addNewNote(
477+
Note(
478+
id = null,
479+
title = getCurrentFormattedDateTime(),
480+
value = "",
481+
type = NoteType.TYPE_TEXT,
482+
path = "",
483+
protectionType = PROTECTION_NONE,
484+
protectionHash = ""
485+
)
484486
)
485-
addNewNote(newTextNote)
486487
} else if (intent.getBooleanExtra(NEW_CHECKLIST, false)) {
487-
val newChecklist = Note(
488-
null,
489-
getCurrentFormattedDateTime(),
490-
"",
491-
NoteType.TYPE_CHECKLIST,
492-
"",
493-
PROTECTION_NONE,
494-
""
488+
addNewNote(
489+
Note(
490+
id = null,
491+
title = getCurrentFormattedDateTime(),
492+
value = "",
493+
type = NoteType.TYPE_CHECKLIST,
494+
path = "",
495+
protectionType = PROTECTION_NONE,
496+
protectionHash = ""
497+
)
495498
)
496-
addNewNote(newChecklist)
497499
} else {
498500
handleUri(data!!)
499501
}
@@ -829,13 +831,13 @@ class MainActivity : SimpleActivity() {
829831
if (checklistItems != null) {
830832
val title = it.absolutePath.getFilenameFromPath().substringBeforeLast('.')
831833
val note = Note(
832-
null,
833-
title,
834-
fileText,
835-
NoteType.TYPE_CHECKLIST,
836-
"",
837-
PROTECTION_NONE,
838-
""
834+
id = null,
835+
title = title,
836+
value = fileText,
837+
type = NoteType.TYPE_CHECKLIST,
838+
path = "",
839+
protectionType = PROTECTION_NONE,
840+
protectionHash = ""
839841
)
840842
runOnUiThread {
841843
OpenFileDialog(this, it.path) {
@@ -946,7 +948,16 @@ class MainActivity : SimpleActivity() {
946948

947949
val noteType = if (checklistItems != null) NoteType.TYPE_CHECKLIST else NoteType.TYPE_TEXT
948950
if (!canSyncNoteWithFile) {
949-
val note = Note(null, noteTitle, content, noteType, "", PROTECTION_NONE, "")
951+
val note = Note(
952+
id = null,
953+
title = noteTitle,
954+
value = content,
955+
type = noteType,
956+
path = "",
957+
protectionType = PROTECTION_NONE,
958+
protectionHash = ""
959+
)
960+
950961
displayNewNoteDialog(note.value, title = noteTitle, "")
951962
} else {
952963
val items = arrayListOf(
@@ -957,7 +968,15 @@ class MainActivity : SimpleActivity() {
957968
RadioGroupDialog(this, items) {
958969
val syncFile = it as Int == IMPORT_FILE_SYNC
959970
val path = if (syncFile) uri.toString() else ""
960-
val note = Note(null, noteTitle, content, noteType, "", PROTECTION_NONE, "")
971+
val note = Note(
972+
id = null,
973+
title = noteTitle,
974+
value = content,
975+
type = noteType,
976+
path = "",
977+
protectionType = PROTECTION_NONE,
978+
protectionHash = ""
979+
)
961980
displayNewNoteDialog(note.value, title = noteTitle, path)
962981
}
963982
}
@@ -971,16 +990,24 @@ class MainActivity : SimpleActivity() {
971990
val checklistItems = fileText.parseChecklistItems()
972991
val note = if (checklistItems != null) {
973992
Note(
974-
null,
975-
title.substringBeforeLast('.'),
976-
fileText,
977-
NoteType.TYPE_CHECKLIST,
978-
"",
979-
PROTECTION_NONE,
980-
""
993+
id = null,
994+
title = title.substringBeforeLast('.'),
995+
value = fileText,
996+
type = NoteType.TYPE_CHECKLIST,
997+
path = "",
998+
protectionType = PROTECTION_NONE,
999+
protectionHash = ""
9811000
)
9821001
} else {
983-
Note(null, title, "", NoteType.TYPE_TEXT, path, PROTECTION_NONE, "")
1002+
Note(
1003+
id = null,
1004+
title = title,
1005+
value = "",
1006+
type = NoteType.TYPE_TEXT,
1007+
path = path,
1008+
protectionType = PROTECTION_NONE,
1009+
protectionHash = ""
1010+
)
9841011
}
9851012

9861013
if (mNotes.any { it.title.equals(note.title, true) }) {

0 commit comments

Comments
 (0)