From e949293a970299a82e706efcc201d06e13a2a635 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 30 May 2023 12:21:05 +0200 Subject: [PATCH] Add feed filter for livestreams --- .../github/libretube/ui/fragments/SubscriptionsFragment.kt | 4 +++- app/src/main/res/values/array.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt index 56a5c7c14..d8cb4cf42 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt @@ -220,10 +220,12 @@ class SubscriptionsFragment : Fragment() { } .filter { // apply the selected filter + val isLive = (it.duration ?: -1L) < 0L when (selectedFilter) { 0 -> true - 1 -> !it.isShort + 1 -> !it.isShort && !isLive 2 -> it.isShort + 3 -> isLive else -> throw IllegalArgumentException() } }.let { streams -> diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 2b457df20..e668e1d85 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -284,6 +284,7 @@ @string/all @string/videos @string/yt_shorts + @string/livestreams