show the Note Exported Successfully message only once it really happened

This commit is contained in:
tibbi 2017-11-10 21:40:02 +01:00
parent 8642731427
commit 900e5bb1bc

View File

@ -330,19 +330,24 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
flush()
close()
}
noteExportedSuccessfully(path.getFilenameFromPath())
}
} else {
file.printWriter().use { out ->
out.write(content)
}
noteExportedSuccessfully(path.getFilenameFromPath())
}
val message = String.format(getString(R.string.note_exported_successfully), path.getFilenameFromPath())
toast(message)
} catch (e: Exception) {
showErrorToast(e)
}
}
private fun noteExportedSuccessfully(title: String) {
val message = String.format(getString(R.string.note_exported_successfully), title)
toast(message)
}
fun noteSavedSuccessfully(title: String) {
if (config.displaySuccess) {
val message = String.format(getString(R.string.note_saved_successfully), title)