Convert PlayerFragment to Kotlin

This commit is contained in:
tzugen 2021-06-19 20:05:38 +02:00
parent 5cfb49ac69
commit 28336c8bf7
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 947 additions and 1428 deletions

View File

@ -388,7 +388,7 @@ class LocalMediaPlayer(
setPlayerState(PlayerState.PREPARING)
mediaPlayer.setOnBufferingUpdateListener { mp, percent ->
val progressBar = PlayerFragment.getProgressBar()
val progressBar = PlayerFragment.progressBar
val song = downloadFile.song
if (percent == 100) {
@ -405,10 +405,10 @@ class LocalMediaPlayer(
mediaPlayer.setOnPreparedListener {
Timber.i("Media player prepared")
setPlayerState(PlayerState.PREPARED)
val progressBar = PlayerFragment.getProgressBar()
val progressBar = PlayerFragment.progressBar
if (progressBar != null && downloadFile.isWorkDone) {
// Populate seek bar secondary progress if we have a complete file for consistency
PlayerFragment.getProgressBar().secondaryProgress = 100 * progressBar.max
PlayerFragment.progressBar.secondaryProgress = 100 * progressBar.max
}
synchronized(this@LocalMediaPlayer) {
if (position != 0) {