[Android] Fix crash in History on Android 4
Geoffrey Métais
git at videolan.org
Thu Aug 1 15:02:07 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 1 15:01:33 2019 +0200| [17fb15ab25afcaa391fc2e323e1ebacd15277754] | committer: Geoffrey Métais
Fix crash in History on Android 4
> https://code.videolan.org/videolan/vlc-android/commit/17fb15ab25afcaa391fc2e323e1ebacd15277754
---
vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt | 6 +++---
vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt | 2 +-
vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt | 6 +++---
vlc-android/src/org/videolan/vlc/viewmodels/MedialibraryModel.kt | 2 +-
vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt | 6 +++---
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
index 4a2e09d4b..ca6e2bf6f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
@@ -1,7 +1,7 @@
/*****************************************************************************
- * HistoryFragment.java
+ * HistoryFragment.kt
*
- * Copyright © 2012-2015 VLC authors and VideoLAN
+ * Copyright © 2012-2019 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -153,7 +153,7 @@ class HistoryFragment : MediaBrowserFragment<HistoryModel>(), IRefreshable, IHis
override fun clearHistory() {
mediaLibrary.clearHistory()
- viewModel.clear()
+ viewModel.clearHistory()
}
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index dbed6dd4c..1a6bf3b17 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -80,7 +80,7 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- viewModel = ViewModelProviders.of(requireActivity(), StreamsModel.Factory(requireContext())).get<StreamsModel>(StreamsModel::class.java)
+ viewModel = ViewModelProviders.of(requireActivity(), StreamsModel.Factory(requireContext())).get(StreamsModel::class.java)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
index a93b177b2..c21d34829 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/HistoryModel.kt
@@ -1,7 +1,7 @@
/*****************************************************************************
* HistoryModel.kt
*****************************************************************************
- * Copyright © 2018 VLC authors and VideoLAN
+ * Copyright © 2018-2019 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,11 +42,11 @@ class HistoryModel(context: Context) : MedialibraryModel<AbstractMediaWrapper>(c
}
}
- fun clear() {
+ fun clearHistory() {
dataset.value = mutableListOf()
}
- class Factory(private val context: Context): ViewModelProvider.NewInstanceFactory() {
+ class Factory(private val context: Context) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@Suppress("UNCHECKED_CAST")
return HistoryModel(context.applicationContext) as T
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/MedialibraryModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/MedialibraryModel.kt
index f34597f59..ccd234046 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/MedialibraryModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/MedialibraryModel.kt
@@ -38,4 +38,4 @@ abstract class MedialibraryModel<T : MediaLibraryItem>(context: Context) : BaseM
releaseCallbacks()
super.onCleared()
}
-}
\ No newline at end of file
+}
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
index 84e712c92..ac467033c 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
@@ -1,7 +1,7 @@
/*******************************************************************************
- * MRLPanelModel.kt
+ * StreamsModel.kt
* ****************************************************************************
- * Copyright © 2018 VLC authors and VideoLAN
+ * Copyright © 2018-2019 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ class StreamsModel(context: Context) : MedialibraryModel<AbstractMediaWrapper>(c
refresh()
}
- class Factory(private val context: Context) : ViewModelProvider.NewInstanceFactory() {
+ class Factory(private val context: Context) : ViewModelProvider.Factory() {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@Suppress("UNCHECKED_CAST")
return StreamsModel(context.applicationContext) as T
More information about the Android
mailing list