mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-25 12:38:45 +02: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)
|
if (mNotes.size <= 1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
val path = mCurrentNote.path
|
||||||
mDb.deleteNote(mCurrentNote.id)
|
mDb.deleteNote(mCurrentNote.id)
|
||||||
mNotes = mDb.getNotes()
|
mNotes = mDb.getNotes()
|
||||||
|
|
||||||
@ -251,6 +252,17 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
config.widgetNoteId = firstNoteId
|
config.widgetNoteId = firstNoteId
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
initViewPager()
|
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() {
|
private fun displayOpenNoteDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user