File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
app/src/main/kotlin/com/simplemobiletools/notes/pro/activities Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1216,17 +1216,21 @@ class MainActivity : SimpleActivity() {
12161216
12171217 private fun doDeleteNote (note : Note , deleteFile : Boolean ) {
12181218 ensureBackgroundThread {
1219+ val currentNoteIndex = mNotes.indexOf(note)
1220+ val noteToRefresh = mNotes[if (currentNoteIndex > 0 ) currentNoteIndex - 1 else currentNoteIndex + 1 ]
1221+
12191222 notesDB.deleteNote(note)
12201223 widgetsDB.deleteNoteWidgets(note.id!! )
1221- refreshNotes(note, deleteFile)
1224+
1225+ refreshNotes(noteToRefresh, deleteFile)
12221226 }
12231227 }
12241228
12251229 private fun refreshNotes (note : Note , deleteFile : Boolean ) {
12261230 NotesHelper (this ).getNotes {
12271231 mNotes = it
1228- val firstNoteId = mNotes[ 0 ] .id
1229- updateSelectedNote(firstNoteId !! )
1232+ val noteId = note .id
1233+ updateSelectedNote(noteId !! )
12301234 if (config.widgetNoteId == note.id) {
12311235 config.widgetNoteId = mCurrentNote.id!!
12321236 updateWidgets()
You can’t perform that action at this time.
0 commit comments