Fix issue where theme songs played when the app is backgrounded (#34)

Previously if the app is playing a show's theme song and the app is
backgrounded, such as by pressing Home, the music would continue. This
PR fixes that.
This commit is contained in:
damontecres 2025-10-18 20:59:38 -04:00 committed by GitHub
parent 5bb46bf34b
commit 93f7abfa3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 82 additions and 39 deletions

View file

@ -37,6 +37,7 @@ import com.github.damontecres.wholphin.ui.nav.NavigationManager
import com.github.damontecres.wholphin.ui.theme.WholphinTheme
import com.github.damontecres.wholphin.util.AppUpgradeHandler
import com.github.damontecres.wholphin.util.ExceptionHandler
import com.github.damontecres.wholphin.util.ThemeSongPlayer
import com.github.damontecres.wholphin.util.UpdateChecker
import com.github.damontecres.wholphin.util.profile.createDeviceProfile
import dagger.hilt.android.AndroidEntryPoint
@ -68,6 +69,9 @@ class MainActivity : AppCompatActivity() {
@Inject
lateinit var appUpgradeHandler: AppUpgradeHandler
@Inject
lateinit var themeSongPlayer: ThemeSongPlayer
@OptIn(ExperimentalTvMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -164,4 +168,9 @@ class MainActivity : AppCompatActivity() {
}
}
}
override fun onStop() {
super.onStop()
themeSongPlayer.stop()
}
}