main: populate menu header in onLogbookLoaded and onLogbookSaved

This targets the dynamic menu setting when only very
few events are available. Before the header stayed empty
when the first events very added, now the header is updated
immediately.
This commit is contained in:
2026-09-05 23:19:44 +02:00
parent 5663a838e7
commit 18578581b5
@@ -86,8 +86,6 @@ class MainActivity : AppCompatActivity() {
recyclerView = findViewById(R.id.list_events)
recyclerView.setLayoutManager(LinearLayoutManager(applicationContext))
populateHeaderMenu()
// Set listeners
findViewById<View>(R.id.logbooks_add_button).setOnClickListener {
showAddLogbookDialog(true)
@@ -138,8 +136,6 @@ class MainActivity : AppCompatActivity() {
allEvents = logbook?.logs ?: arrayListOf()
setListAdapter(allEvents)
populateHeaderMenu()
}
private fun populateHeaderMenu() {
@@ -1127,6 +1123,8 @@ class MainActivity : AppCompatActivity() {
logbook = lb
showLogbook()
populateHeaderMenu()
if (DEBUG_CHECK_LOGBOOK_CONSISTENCY) {
for (e in logbook?.logs ?: listOf()) {
val em = e.getHeaderEmoji(this@MainActivity)
@@ -1245,6 +1243,8 @@ class MainActivity : AppCompatActivity() {
Toast.LENGTH_SHORT
).show()
savingEvent(false)
populateHeaderMenu()
})
}