@@ -8,6 +8,7 @@ import com.simplemobiletools.commons.extensions.showKeyboard
88import com.simplemobiletools.commons.extensions.toast
99import com.simplemobiletools.commons.extensions.value
1010import com.simplemobiletools.notes.pro.R
11+ import com.simplemobiletools.notes.pro.extensions.config
1112import com.simplemobiletools.notes.pro.extensions.notesDB
1213import com.simplemobiletools.notes.pro.helpers.TYPE_CHECKLIST
1314import com.simplemobiletools.notes.pro.helpers.TYPE_TEXT
@@ -16,7 +17,9 @@ import kotlinx.android.synthetic.main.dialog_new_note.view.*
1617
1718class NewNoteDialog (val activity : Activity , callback : (note: Note ) -> Unit ) {
1819 init {
19- val view = activity.layoutInflater.inflate(R .layout.dialog_new_note, null )
20+ val view = activity.layoutInflater.inflate(R .layout.dialog_new_note, null ).apply {
21+ new_note_type.check(if (activity.config.lastCreatedNoteType == TYPE_TEXT ) type_text_note.id else type_checklist.id)
22+ }
2023
2124 AlertDialog .Builder (activity)
2225 .setPositiveButton(R .string.ok, null )
@@ -32,6 +35,7 @@ class NewNoteDialog(val activity: Activity, callback: (note: Note) -> Unit) {
3235 activity.notesDB.getNoteIdWithTitle(title) != null -> activity.toast(R .string.title_taken)
3336 else -> {
3437 val type = if (view.new_note_type.checkedRadioButtonId == view.type_checklist.id) TYPE_CHECKLIST else TYPE_TEXT
38+ activity.config.lastCreatedNoteType = type
3539 val newNote = Note (null , title, " " , type)
3640 callback(newNote)
3741 dismiss()
0 commit comments