Fix stale cursor line after a sync completes in the foreground
renderStatus() only rewrote the status TextView, so the 'Last sync cursor' line kept its launch-time value until the next onResume - on a fresh install a successful sync still displayed 'never'. It now delegates to refreshStatus() which refreshes both lines.
This commit is contained in:
@@ -218,12 +218,17 @@ class MainActivity : AppCompatActivity() {
|
||||
statusText.text = p.lastStatus.ifBlank { getString(R.string.status_idle) }
|
||||
}
|
||||
|
||||
/** Repaints the status line from whatever sync is in flight right now. */
|
||||
/**
|
||||
* Repaints the status/cursor lines from whatever sync is in flight right now.
|
||||
* When nothing is running this delegates to [refreshStatus] so the cursor line
|
||||
* also refreshes while the app stays in the foreground (otherwise a completed
|
||||
* sync would leave a stale "Last sync cursor" until the next onResume).
|
||||
*/
|
||||
private fun renderStatus() {
|
||||
statusText.text = if (oneShotSyncActive || periodicSyncRunning) {
|
||||
"Syncing…"
|
||||
if (oneShotSyncActive || periodicSyncRunning) {
|
||||
statusText.text = "Syncing…"
|
||||
} else {
|
||||
Prefs(this).lastStatus.ifBlank { getString(R.string.status_idle) }
|
||||
refreshStatus()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user