Further improvements to resuming the app (#577)

## Description
Fixes issues when the app is resumed, such as after the screensaver is
dismissed.

For example, if you pause during playback and the screensaver starts,
Wholphin will stop playback and go back to the previous page. But with
this PR, instead of focus being lost and defaulting to teh nav drawer,
focus will restore on the play button or episode card.

### Related issues
Related to #552 &
https://github.com/damontecres/Wholphin/issues/552#issuecomment-3690614491
This commit is contained in:
Ray 2025-12-26 15:40:52 -05:00 committed by GitHub
parent bdec72752d
commit a797bd8267
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 127 additions and 94 deletions

View file

@ -230,7 +230,7 @@ class MainActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
Timber.i("onResume")
Timber.d("onResume")
lifecycleScope.launchIO {
appUpgradeHandler.run()
}
@ -238,7 +238,7 @@ class MainActivity : AppCompatActivity() {
override fun onRestart() {
super.onRestart()
Timber.i("onRestart")
Timber.d("onRestart")
viewModel.appStart()
// val signInAutomatically =
// runBlocking { userPreferencesDataStore.data.firstOrNull()?.signInAutomatically } ?: true
@ -250,35 +250,35 @@ class MainActivity : AppCompatActivity() {
// }
}
// override fun onStop() {
// super.onStop()
// Timber.i("onStop")
// }
//
// override fun onPause() {
// super.onPause()
// Timber.i("onPause")
// }
//
// override fun onStart() {
// super.onStart()
// Timber.i("onStart")
// }
//
// override fun onSaveInstanceState(outState: Bundle) {
// super.onSaveInstanceState(outState)
// Timber.i("onSaveInstanceState")
// }
//
// override fun onRestoreInstanceState(savedInstanceState: Bundle) {
// super.onRestoreInstanceState(savedInstanceState)
// Timber.i("onRestoreInstanceState")
// }
//
// override fun onDestroy() {
// super.onDestroy()
// Timber.i("onDestroy")
// }
override fun onStop() {
super.onStop()
Timber.d("onStop")
}
override fun onPause() {
super.onPause()
Timber.d("onPause")
}
override fun onStart() {
super.onStart()
Timber.d("onStart")
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
Timber.d("onSaveInstanceState")
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
Timber.d("onRestoreInstanceState")
}
override fun onDestroy() {
super.onDestroy()
Timber.d("onDestroy")
}
}
@HiltViewModel