[Android] Make History fragment medialibrary agnostic
Geoffrey Métais
git at videolan.org
Wed Jan 16 11:09:47 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 16 11:01:28 2019 +0100| [140894c203bc6e1d5829d55e7dfd3f3add5d2c8e] | committer: Geoffrey Métais
Make History fragment medialibrary agnostic
> https://code.videolan.org/videolan/vlc-android/commit/140894c203bc6e1d5829d55e7dfd3f3add5d2c8e
---
vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java | 3 +--
vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index bce89bc0d..ab2cc269b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -84,8 +84,7 @@ public class HistoryFragment extends MediaBrowserFragment<HistoryModel> implemen
}
@Override
- public void onStart() {
- super.onStart();
+ protected void onRestart() {
viewModel.refresh();
}
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
index 81682dc14..9adb931ca 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
@@ -25,15 +25,14 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
-import org.videolan.medialibrary.Medialibrary
import org.videolan.medialibrary.media.MediaWrapper
-class HistoryModel(context: Context) : BaseModel<MediaWrapper>(context) {
+class HistoryModel(context: Context) : MedialibraryModel<MediaWrapper>(context) {
override fun canSortByName() = false
override suspend fun updateList() {
- dataset.value = withContext(Dispatchers.Default) { Medialibrary.getInstance().lastMediaPlayed().toMutableList() }
+ dataset.value = withContext(Dispatchers.Default) { medialibrary.lastMediaPlayed().toMutableList() }
}
fun moveUp(media: MediaWrapper) {
More information about the Android
mailing list