[Android] Remove useless LifecycleObserver interface from the player options
Nicolas Pomepuy
git at videolan.org
Mon May 13 12:24:30 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri May 3 09:13:46 2024 +0200| [9c3713e2fa8c69470ad5b1274b82ec846be2b967] | committer: Duncan McNamara
Remove useless LifecycleObserver interface from the player options
Fixes some mem leaks
> https://code.videolan.org/videolan/vlc-android/commit/9c3713e2fa8c69470ad5b1274b82ec846be2b967
---
.../src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index 0ecd3e79b8..8f0f0c9a09 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -71,7 +71,7 @@ private const val ID_AUDIO_CONTROL_SETTING = 20L
private const val ID_SAFE_MODE_LOCK = 21L
private const val ID_SAFE_MODE_UNLOCK = 22L
@SuppressLint("ShowToast")
-class PlayerOptionsDelegate(val activity: FragmentActivity, val service: PlaybackService, private val showABReapeat:Boolean = true) : LifecycleObserver {
+class PlayerOptionsDelegate(val activity: FragmentActivity, val service: PlaybackService, private val showABReapeat:Boolean = true) {
private lateinit var bookmarkClickedListener: () -> Unit
private lateinit var recyclerview: RecyclerView
@@ -145,8 +145,6 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
if (recyclerview.hasFocus()) focused // keep focus on recyclerview! DO NOT return recyclerview, but focused, which is a child of the recyclerview
else null // someone else will find the next focus
}
- service.lifecycle.addObserver(this)
- activity.lifecycle.addObserver(this)
if (recyclerview.layoutManager == null) recyclerview.layoutManager = LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
recyclerview.adapter = OptionsAdapter()
recyclerview.itemAnimator = null
More information about the Android
mailing list