mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-24 20:40:09 +01:00
Don't update note info if export failed
This commit is contained in:
parent
cbba53b798
commit
ab0d7a5666
@ -750,17 +750,19 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
RadioGroupDialog(this, items) {
|
RadioGroupDialog(this, items) {
|
||||||
val syncFile = it as Int == EXPORT_FILE_SYNC
|
val syncFile = it as Int == EXPORT_FILE_SYNC
|
||||||
tryExportNoteValueToFile(exportPath, textToExport, true) {
|
tryExportNoteValueToFile(exportPath, textToExport, true) { exportedSuccessfully ->
|
||||||
if (syncFile) {
|
if (exportedSuccessfully) {
|
||||||
mCurrentNote.path = exportPath
|
if (syncFile) {
|
||||||
mCurrentNote.value = ""
|
mCurrentNote.path = exportPath
|
||||||
} else {
|
mCurrentNote.value = ""
|
||||||
mCurrentNote.path = ""
|
} else {
|
||||||
mCurrentNote.value = textToExport
|
mCurrentNote.path = ""
|
||||||
}
|
mCurrentNote.value = textToExport
|
||||||
|
}
|
||||||
|
|
||||||
getPagerAdapter().updateCurrentNoteData(view_pager.currentItem, mCurrentNote.path, mCurrentNote.value)
|
getPagerAdapter().updateCurrentNoteData(view_pager.currentItem, mCurrentNote.path, mCurrentNote.value)
|
||||||
NotesHelper(this).insertOrUpdateNote(mCurrentNote)
|
NotesHelper(this).insertOrUpdateNote(mCurrentNote)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -792,23 +794,26 @@ class MainActivity : SimpleActivity() {
|
|||||||
toast(String.format(getString(R.string.filename_invalid_characters_placeholder, filename)))
|
toast(String.format(getString(R.string.filename_invalid_characters_placeholder, filename)))
|
||||||
} else {
|
} else {
|
||||||
val noteStoredValue = note.getNoteStoredValue(this) ?: ""
|
val noteStoredValue = note.getNoteStoredValue(this) ?: ""
|
||||||
tryExportNoteValueToFile(file.absolutePath, note.value, false) {
|
tryExportNoteValueToFile(file.absolutePath, note.value, false) { exportedSuccessfully ->
|
||||||
if (syncFile) {
|
if (exportedSuccessfully) {
|
||||||
note.path = file.absolutePath
|
if (syncFile) {
|
||||||
note.value = ""
|
note.path = file.absolutePath
|
||||||
} else {
|
note.value = ""
|
||||||
note.path = ""
|
} else {
|
||||||
note.value = noteStoredValue
|
note.path = ""
|
||||||
|
note.value = noteStoredValue
|
||||||
|
}
|
||||||
|
|
||||||
|
NotesHelper(this).insertOrUpdateNote(note)
|
||||||
}
|
}
|
||||||
|
|
||||||
NotesHelper(this).insertOrUpdateNote(note)
|
|
||||||
if (mCurrentNote.id == note.id) {
|
if (mCurrentNote.id == note.id) {
|
||||||
mCurrentNote.value = note.value
|
mCurrentNote.value = note.value
|
||||||
mCurrentNote.path = note.path
|
mCurrentNote.path = note.path
|
||||||
getPagerAdapter().updateCurrentNoteData(view_pager.currentItem, mCurrentNote.path, mCurrentNote.value)
|
getPagerAdapter().updateCurrentNoteData(view_pager.currentItem, mCurrentNote.path, mCurrentNote.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!it) {
|
if (!exportedSuccessfully) {
|
||||||
failCount++
|
failCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user