mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-14 15:32:27 +02:00
fix #102, fix a couple glitches related to notes and updating the widget
This commit is contained in:
parent
ba2a9af7fb
commit
37fc8000f9
@ -25,6 +25,7 @@ import com.simplemobiletools.notes.adapters.NotesPagerAdapter
|
|||||||
import com.simplemobiletools.notes.dialogs.*
|
import com.simplemobiletools.notes.dialogs.*
|
||||||
import com.simplemobiletools.notes.extensions.config
|
import com.simplemobiletools.notes.extensions.config
|
||||||
import com.simplemobiletools.notes.extensions.getTextSize
|
import com.simplemobiletools.notes.extensions.getTextSize
|
||||||
|
import com.simplemobiletools.notes.extensions.updateWidget
|
||||||
import com.simplemobiletools.notes.helpers.DBHelper
|
import com.simplemobiletools.notes.helpers.DBHelper
|
||||||
import com.simplemobiletools.notes.helpers.MIME_TEXT_PLAIN
|
import com.simplemobiletools.notes.helpers.MIME_TEXT_PLAIN
|
||||||
import com.simplemobiletools.notes.helpers.OPEN_NOTE_ID
|
import com.simplemobiletools.notes.helpers.OPEN_NOTE_ID
|
||||||
@ -349,13 +350,17 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
if (mNotes.size <= 1)
|
if (mNotes.size <= 1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
val deletedNoteId = mCurrentNote.id
|
||||||
val path = mCurrentNote.path
|
val path = mCurrentNote.path
|
||||||
mDb.deleteNote(mCurrentNote.id)
|
mDb.deleteNote(mCurrentNote.id)
|
||||||
mNotes = mDb.getNotes()
|
mNotes = mDb.getNotes()
|
||||||
|
|
||||||
val firstNoteId = mNotes[0].id
|
val firstNoteId = mNotes[0].id
|
||||||
updateSelectedNote(firstNoteId)
|
updateSelectedNote(firstNoteId)
|
||||||
config.widgetNoteId = firstNoteId
|
if (config.widgetNoteId == deletedNoteId) {
|
||||||
|
config.widgetNoteId = mCurrentNote.id
|
||||||
|
updateWidget()
|
||||||
|
}
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
initViewPager()
|
initViewPager()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user