Fix dropdown not updated on logbook creation, refinements
This commit is contained in:
parent
36f52234a3
commit
ac9f74dbd7
@ -373,9 +373,48 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
fun addLogbook(logbookName: String) {
|
||||
this.logbook = Logbook(logbookName)
|
||||
saveLogbook()
|
||||
loadLogbookList() // TODO: Does not reload logbooks buttons on top, why?
|
||||
val newLogbook = Logbook(logbookName)
|
||||
setLoading(true)
|
||||
logbookRepo?.saveLogbook(this, newLogbook, object: LogbookSavedListener{
|
||||
override fun onLogbookSaved() {
|
||||
Log.d(TAG, "Logbook $logbookName created")
|
||||
runOnUiThread({
|
||||
setLoading(false)
|
||||
loadLogbookList()
|
||||
Toast.makeText(this@MainActivity, getString(R.string.logbook_created) + logbookName, Toast.LENGTH_SHORT).show()
|
||||
})
|
||||
}
|
||||
|
||||
override fun onIOError(error: IOException) {
|
||||
runOnUiThread({
|
||||
onRepoError(getString(R.string.settings_network_error) + error.toString())
|
||||
})
|
||||
}
|
||||
|
||||
override fun onWebDAVError(error: SardineException) {
|
||||
runOnUiThread({
|
||||
onRepoError(
|
||||
if(error.toString().contains("401")) {
|
||||
getString(R.string.settings_webdav_error_denied)
|
||||
} else {
|
||||
getString(R.string.settings_webdav_error_generic) + error.toString()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
override fun onJSONError(error: JSONException) {
|
||||
runOnUiThread({
|
||||
onRepoError(getString(R.string.settings_json_error) + error.toString())
|
||||
})
|
||||
}
|
||||
|
||||
override fun onError(error: Exception) {
|
||||
runOnUiThread({
|
||||
onRepoError(getString(R.string.settings_generic_error) + error.toString())
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun loadLogbook(name: String) {
|
||||
|
@ -81,9 +81,10 @@
|
||||
<string name="dialog_event_detail_title">Dettaglio evento</string>
|
||||
|
||||
<string name="dialog_add_logbook_title">Aggiungi diario</string>
|
||||
<string name="dialog_add_logbook_logbookname">Nome del diario</string>
|
||||
<string name="dialog_add_logbook_message">Scrivi un nome per identificare questo diario. Comparirà in cima allo schermo, e se usi WebDAV sarà incluso anche nel nome del file di salvataggio.</string>
|
||||
<string name="dialog_add_logbook_logbookname">👶 Nome del diario</string>
|
||||
<string name="dialog_add_logbook_message">Scrivi un nome per identificare questo diario. Comparirà in cima allo schermo, e se usi WebDAV sarà incluso anche nel nome del file di salvataggio.\nSe vuoi un\'icona, inserisci una emoji!</string>
|
||||
|
||||
<string name="default_logbook_name">👶 Il mio primo diario</string>
|
||||
<string name="logbook_created">Creato nuovo diario: </string>
|
||||
|
||||
</resources>
|
@ -104,9 +104,10 @@
|
||||
<string name="dialog_event_detail_title">Event detail</string>
|
||||
|
||||
<string name="dialog_add_logbook_title">Add logbook</string>
|
||||
<string name="dialog_add_logbook_logbookname">Logbook name</string>
|
||||
<string name="dialog_add_logbook_logbookname">👶 Logbook name</string>
|
||||
<string name="dialog_add_logbook_message">Write a name to identify this logbook. This name will appear on top of the screen and, if you use WebDAV, will be in the save file name as well.</string>
|
||||
|
||||
<string name="default_logbook_name">👶 My first logbook</string>
|
||||
<string name="logbook_created">New logbook created: </string>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user