display success toast at saving notes

This commit is contained in:
tibbi
2017-03-08 22:22:59 +01:00
parent b2dec578f8
commit 13d09de4be
11 changed files with 43 additions and 1 deletions

View File

@ -216,12 +216,17 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
out.write(content)
}
}
toast(R.string.file_saved)
noteSavedSuccessfully()
} catch (e: Exception) {
toast(R.string.unknown_error_occurred)
}
}
fun noteSavedSuccessfully() {
val message = String.format(getString(R.string.note_saved_successfully), mCurrentNote.title)
toast(message)
}
private fun getCurrentNoteText() = (view_pager.adapter as NotesPagerAdapter).getCurrentNoteText(view_pager.currentItem)
private fun displayDeleteNotePrompt() {

View File

@ -77,6 +77,7 @@ class NoteFragment : Fragment() {
private fun saveNoteValue(note: Note) {
if (note.path.isEmpty()) {
mDb.updateNoteValue(note)
(activity as MainActivity).noteSavedSuccessfully()
} else {
(activity as MainActivity).saveNoteValueToFile(note.path, getCurrentNoteViewText())
}