[Android] Remove useless Handler in AudioPlayerActivity
Nicolas Pomepuy
git at videolan.org
Tue Jul 25 14:57:29 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jul 20 14:43:55 2023 +0200| [b610eb7f67c98ac51555281798f33f4a2d566835] | committer: Duncan McNamara
Remove useless Handler in AudioPlayerActivity
> https://code.videolan.org/videolan/vlc-android/commit/b610eb7f67c98ac51555281798f33f4a2d566835
---
.../videolan/television/ui/audioplayer/AudioPlayerActivity.kt | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/audioplayer/AudioPlayerActivity.kt b/application/television/src/main/java/org/videolan/television/ui/audioplayer/AudioPlayerActivity.kt
index 5f3d300546..bd3d79ec4f 100644
--- a/application/television/src/main/java/org/videolan/television/ui/audioplayer/AudioPlayerActivity.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/audioplayer/AudioPlayerActivity.kt
@@ -25,8 +25,6 @@ import android.content.SharedPreferences
import android.net.Uri
import android.os.Build
import android.os.Bundle
-import android.os.Handler
-import android.os.Looper
import android.support.v4.media.session.PlaybackStateCompat
import android.text.format.DateFormat
import android.view.*
@@ -68,7 +66,6 @@ class AudioPlayerActivity : BaseTvActivity(),KeycodeListener {
private lateinit var binding: TvAudioPlayerBinding
private lateinit var adapter: PlaylistAdapter
- private val handler = Handler(Looper.getMainLooper())
private var lastMove: Long = 0
private var shuffling = false
private var currentCoverArt: String? = null
@@ -393,14 +390,14 @@ class AudioPlayerActivity : BaseTvActivity(),KeycodeListener {
}
fun onUpdateFinished() {
- handler.post(Runnable {
+ binding.root.post {
val position = model.currentMediaPosition
- if (position < 0) return at Runnable
+ if (position < 0) return at post
adapter.setSelection(position)
val first = (binding.playlist.layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()
val last = (binding.playlist.layoutManager as LinearLayoutManager).findLastCompletelyVisibleItemPosition()
if (position < first || position > last) binding.playlist.smoothScrollToPosition(position)
- })
+ }
}
companion object {
More information about the Android
mailing list