[Android] TvUtils openmedia: remove unused model argument
Nicolas Pomepuy
git at videolan.org
Tue Nov 22 13:57:18 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Nov 22 08:07:21 2022 +0100| [7eb4bb39e369a6acc0b14dbb4f582577bf984d42] | committer: Duncan McNamara
TvUtils openmedia: remove unused model argument
The model was never used and prevented the playback of items
when it was null
Fixes #2770
> https://code.videolan.org/videolan/vlc-android/commit/7eb4bb39e369a6acc0b14dbb4f582577bf984d42
---
.../videolan/television/ui/MediaItemDetailsFragment.kt | 2 +-
.../java/org/videolan/television/ui/SearchFragment.kt | 2 +-
.../src/main/java/org/videolan/television/ui/TvUtil.kt | 15 ++-------------
3 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt b/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt
index d5ce49d0c7..23bebd9548 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt
@@ -368,7 +368,7 @@ class MediaItemDetailsFragment : DetailsSupportFragment(), CoroutineScope by Mai
rowsAdapter.notifyArrayItemRangeChanged(0, rowsAdapter.size())
Toast.makeText(activity, R.string.favorite_removed, Toast.LENGTH_SHORT).show()
}
- ID_BROWSE -> TvUtil.openMedia(activity, viewModel.media, null)
+ ID_BROWSE -> TvUtil.openMedia(activity, viewModel.media)
ID_DL_SUBS -> MediaUtils.getSubs(requireActivity(), viewModel.media)
ID_PLAY_FROM_START -> {
viewModel.mediaStarted = false
diff --git a/application/television/src/main/java/org/videolan/television/ui/SearchFragment.kt b/application/television/src/main/java/org/videolan/television/ui/SearchFragment.kt
index c844b95d5b..8a55673be7 100644
--- a/application/television/src/main/java/org/videolan/television/ui/SearchFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/SearchFragment.kt
@@ -45,7 +45,7 @@ class SearchFragment : SearchSupportFragment(), SearchSupportFragment.SearchResu
private val rowsAdapter = ArrayObjectAdapter(ListRowPresenter())
private val defaultItemClickedListener: OnItemViewClickedListener
get() = OnItemViewClickedListener { _, item, _, _ ->
- if (item is MediaWrapper) TvUtil.openMedia(requireActivity(), item, null)
+ if (item is MediaWrapper) TvUtil.openMedia(requireActivity(), item)
else TvUtil.openAudioCategory(requireActivity(), item as MediaLibraryItem)
requireActivity().finish()
}
diff --git a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
index 771619cce5..5a5ecb664d 100644
--- a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
@@ -60,7 +60,6 @@ import org.videolan.vlc.providers.medialibrary.MedialibraryProvider
import org.videolan.vlc.util.ThumbnailsProvider
import org.videolan.vlc.util.getScreenHeight
import org.videolan.vlc.util.getScreenWidth
-import org.videolan.vlc.viewmodels.BaseModel
import org.videolan.vlc.viewmodels.browser.BrowserModel
import java.util.*
@@ -133,15 +132,9 @@ object TvUtil {
}
@Suppress("UNCHECKED_CAST")
- fun openMedia(activity: FragmentActivity, item: Any?, model: BaseModel<out MediaLibraryItem>?) {
+ fun openMedia(activity: FragmentActivity, item: Any?) {
when (item) {
is MediaWrapper -> when (item.type) {
- MediaWrapper.TYPE_AUDIO -> {
- val list = (model?.dataset?.getList() as? List<MediaWrapper>)?.filter { it.type != MediaWrapper.TYPE_DIR }
- ?: return
- val position = list.getposition(item)
- playAudioList(activity, list, position)
- }
MediaWrapper.TYPE_DIR -> {
val intent = Intent(activity, VerticalGridActivity::class.java)
intent.putExtra(MainTvActivity.BROWSER_TYPE, if ("file" == item.uri.scheme) HEADER_DIRECTORIES else HEADER_NETWORK)
@@ -156,11 +149,7 @@ object TvUtil {
activity.startActivity(intent)
}
else -> {
- model?.run {
- val list = (dataset.getList() as List<MediaWrapper>).filter { it.type != MediaWrapper.TYPE_DIR }
- val position = list.getposition(item)
- MediaUtils.openList(activity, list, position)
- } ?: MediaUtils.openMedia(activity, item)
+ MediaUtils.openMedia(activity, item)
}
}
is DummyItem -> when (item.id) {
More information about the Android
mailing list