[Android] Fix audio browser 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:45:13 2023 +0200| [94de02e6556e1d7ba756e5a7f656f6a43296636f] | committer: Nicolas Pomepuy
Fix audio browser leaks
> https://code.videolan.org/videolan/vlc-android/commit/94de02e6556e1d7ba756e5a7f656f6a43296636f
---
.../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt | 5 +++++
.../vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt | 1 +
2 files changed, 6 insertions(+)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index deb2d77ad1..4422671acc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -154,6 +154,11 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
}
}
+ override fun onDestroy() {
+ viewPager.setOnTouchListener(null)
+ super.onDestroy()
+ }
+
override fun onDisplaySettingChanged(key: String, value: Any) {
when (key) {
DISPLAY_IN_CARDS -> {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
index f04c665b24..a612113e5f 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
@@ -219,6 +219,7 @@ abstract class BaseAudioBrowser<T : MedialibraryViewModel> : MediaBrowserFragmen
if (::viewPager.isInitialized) viewPager.removeOnPageChangeListener(layoutOnPageChangeListener)
tabLayout?.removeOnTabSelectedListener(this)
if (::viewPager.isInitialized) viewPager.removeOnPageChangeListener(this)
+ tabLayout?.setupWithViewPager(null)
}
override fun onStart() {
More information about the Android
mailing list