[Android] TV: Fix audio categories opening
Geoffrey Métais
git at videolan.org
Mon Jun 4 16:03:50 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 4 16:02:36 2018 +0200| [1cb4072776685c9ae98cb8259aacac8ef7775559] | committer: Geoffrey Métais
TV: Fix audio categories opening
> https://code.videolan.org/videolan/vlc-android/commit/1cb4072776685c9ae98cb8259aacac8ef7775559
---
vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt | 8 ++++----
.../org/videolan/vlc/gui/tv/browser/MediaLibBrowserFragment.kt | 10 ----------
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
index 23f10a544..8ee4a4cc8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
@@ -112,8 +112,8 @@ object TvUtil {
}
fun openMedia(activity: Activity, item: Any?, row: Row?) {
- if (item is MediaWrapper) {
- when {
+ when (item) {
+ is MediaWrapper -> when {
item.type == MediaWrapper.TYPE_AUDIO -> openAudioCategory(activity, item)
item.type == MediaWrapper.TYPE_DIR -> {
val intent = Intent(activity, VerticalGridActivity::class.java)
@@ -130,8 +130,7 @@ object TvUtil {
}
else -> MediaUtils.openMedia(activity, item)
}
- } else if (item is DummyItem) {
- if (item.id == Constants.HEADER_STREAM) {
+ is DummyItem -> if (item.id == Constants.HEADER_STREAM) {
activity.startActivity(Intent(activity, DialogActivity::class.java).setAction(DialogActivity.KEY_STREAM)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
} else {
@@ -139,6 +138,7 @@ object TvUtil {
intent.putExtra(MainTvActivity.BROWSER_TYPE, item.id)
activity.startActivity(intent)
}
+ is MediaLibraryItem -> openAudioCategory(activity, item)
}
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaLibBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaLibBrowserFragment.kt
index d94df459f..4bd8a967f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaLibBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaLibBrowserFragment.kt
@@ -88,16 +88,6 @@ abstract class MediaLibBrowserFragment<T : BaseModel<out MediaLibraryItem>> : Gr
override fun onItemClicked(itemViewHolder: Presenter.ViewHolder?, item: Any?,
rowViewHolder: RowPresenter.ViewHolder?, row: Row?) {
-// if (mediaLibraryItem.itemType == MediaLibraryItem.TYPE_MEDIA) {
-// var position = 0
-// for (i in mDataList.indices) {
-// if (mediaLibraryItem.equals(mDataList[i])) {
-// position = i
-// break
-// }
-// }
-// TvUtil.playAudioList(mContext, mDataList as Array<MediaWrapper>, position)
-// } else
TvUtil.openMedia(mContext, item, row)
}
More information about the Android
mailing list