[Android] Audio player: Fix playlist viewmodel lifecycle
Geoffrey Métais
git at videolan.org
Tue Feb 5 11:25:56 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 5 10:13:48 2019 +0100| [43e23f5b190702c5bcacf63ce5528c940a915918] | committer: Geoffrey Métais
Audio player: Fix playlist viewmodel lifecycle
> https://code.videolan.org/videolan/vlc-android/commit/43e23f5b190702c5bcacf63ce5528c940a915918
---
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 1 -
vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 7fa44fb4e..2fa454bdd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -451,7 +451,6 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher {
super.onDestroy()
if (this::optionsDelegate.isInitialized) optionsDelegate.release()
playlistModel.dataset.removeObserver(playlistObserver)
- playlistModel.onCleared()
}
private inner class LongSeekListener(internal var forward: Boolean, internal var normal: Int, internal var pressed: Int) : View.OnTouchListener {
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
index 701d41147..1da132df9 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/PlaylistModel.kt
@@ -217,7 +217,7 @@ class PlaylistModel : ScopedModel(), PlaybackService.Callback by EmptyPBSCallbac
}
companion object {
- fun get(fragment: Fragment) = ViewModelProviders.of(fragment).get(PlaylistModel::class.java)
+ fun get(fragment: Fragment) = ViewModelProviders.of(fragment.requireActivity()).get(PlaylistModel::class.java)
}
}
More information about the Android
mailing list