[Android] Fix PlaylistFragment leaks

Nicolas Pomepuy git at videolan.org
Thu Sep 7 08:21:02 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jul 25 13:56:22 2023 +0200| [1718c0511c72a71689b147691cd4566583c6bb24] | committer: Nicolas Pomepuy

Fix PlaylistFragment leaks

> https://code.videolan.org/videolan/vlc-android/commit/1718c0511c72a71689b147691cd4566583c6bb24
---

 .../vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt        | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
index 192d7abd66..2068c24e15 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
@@ -104,16 +104,16 @@ class PlaylistFragment : BaseAudioBrowser<PlaylistsViewModel>(), SwipeRefreshLay
         playlists.adapter = playlistAdapter
         fastScroller = view.rootView.findViewById(R.id.songs_fast_scroller_playlist) as FastScroller
         fastScroller.attachToCoordinator(requireActivity().findViewById(R.id.appbar) as AppBarLayout, requireActivity().findViewById(R.id.coordinator) as CoordinatorLayout, requireActivity().findViewById(R.id.fab) as FloatingActionButton)
-        viewModel.provider.pagedList.observe(requireActivity()) {
+        viewModel.provider.pagedList.observe(viewLifecycleOwner) {
             @Suppress("UNCHECKED_CAST")
             playlistAdapter.submitList(it as PagedList<MediaLibraryItem>)
             updateEmptyView()
         }
-        viewModel.provider.loading.observe(requireActivity()) { loading ->
+        viewModel.provider.loading.observe(viewLifecycleOwner) { loading ->
             if (isResumed) setRefreshing(loading) { }
         }
 
-        viewModel.provider.liveHeaders.observe(requireActivity()) {
+        viewModel.provider.liveHeaders.observe(viewLifecycleOwner) {
             playlists.invalidateItemDecorations()
         }
 



More information about the Android mailing list