mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-02-26 08:07:41 +01:00
delete the note file if chosen so
This commit is contained in:
parent
dff96b04f1
commit
05099e4753
@ -243,6 +243,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
if (mNotes.size <= 1)
|
||||
return
|
||||
|
||||
val path = mCurrentNote.path
|
||||
mDb.deleteNote(mCurrentNote.id)
|
||||
mNotes = mDb.getNotes()
|
||||
|
||||
@ -251,6 +252,17 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
config.widgetNoteId = firstNoteId
|
||||
invalidateOptionsMenu()
|
||||
initViewPager()
|
||||
|
||||
if (deleteFile) {
|
||||
val file = File(path)
|
||||
if (!file.delete() && !tryFastDocumentDelete(file)) {
|
||||
val document = getFileDocument(path, config.treeUri) ?: return
|
||||
|
||||
if (!document.isFile || !document.delete()) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun displayOpenNoteDialog() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user