From 15c6a643b4b2ed8c70f7ab1ce36ed7b02d980405 Mon Sep 17 00:00:00 2001 From: UcnacDx2 <127503808+UcnacDx2@users.noreply.github.com> Date: Thu, 8 May 2025 14:19:11 +0800 Subject: [PATCH] Add TOPIC_LIST to filterPopular (#1650) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了热门选项卡-热门话题的过滤 --- app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt | 6 ++++++ app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt | 5 +++++ app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 13 insertions(+) diff --git a/app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt b/app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt index b559a7a226..e6dfdb3b7a 100644 --- a/app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt +++ b/app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt @@ -30,6 +30,10 @@ class HomeFilterDialog(activity: Activity, prefs: SharedPreferences) : .let { root.addView(it.first); it.second } hideFollowSwitch.isChecked = prefs.getBoolean("hide_suggest_follow_popular", false) + val hideTopicListSwitch = switchPrefsItem(string(R.string.hide_topic_list_popular_summary)) + .let { root.addView(it.first); it.second } + hideTopicListSwitch.isChecked = prefs.getBoolean("hide_topic_list_popular", false) + val applyToRelateSwitch = switchPrefsItem(string(R.string.apply_to_relate_title)) .let { root.addView(it.first); it.second } applyToRelateSwitch.isChecked = prefs.getBoolean("home_filter_apply_to_relate", false) @@ -93,6 +97,7 @@ class HomeFilterDialog(activity: Activity, prefs: SharedPreferences) : setPositiveButton(android.R.string.ok) { _, _ -> val hideTop = hideTopSwitch.isChecked val hideSuggestFollow = hideFollowSwitch.isChecked + val hideTopicList = hideTopicListSwitch.isChecked val lowPlayCount = lowPlayCountInput.text.toString().toLongOrNull() ?: 0 val shortDuration = shortDurationInput.text.toString().toIntOrNull() ?: 0 @@ -119,6 +124,7 @@ class HomeFilterDialog(activity: Activity, prefs: SharedPreferences) : prefs.edit().apply { putBoolean("hide_top_entrance_popular", hideTop) + putBoolean("hide_topic_list_popular", hideTopicList) putBoolean("hide_suggest_follow_popular", hideSuggestFollow) putLong("hide_low_play_count_recommend_limit", lowPlayCount) putInt("hide_short_duration_recommend_limit", shortDuration) diff --git a/app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt index fb0ddd9231..994a3be33e 100644 --- a/app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt +++ b/app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt @@ -50,6 +50,7 @@ class PegasusHook(classLoader: ClassLoader) : BaseHook(classLoader) { private val hideTopEntrance = sPrefs.getBoolean("hide_top_entrance_popular", false) private val hideSuggestFollow = sPrefs.getBoolean("hide_suggest_follow_popular", false) + private val hideTopicList = sPrefs.getBoolean("hide_topic_list_popular", true) private val filterMap = mapOf( "advertisement" to listOf("ad", "cm", "cm_v2"), @@ -708,6 +709,10 @@ class PegasusHook(classLoader: ClassLoader) : BaseHook(classLoader) { popularDataCount++ return@removeIf hideSuggestFollow } + "TOPIC_LIST" -> { + popularDataCount++ + return@removeIf hideTopicList + } else -> { popularDataCount++ return@removeIf false diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 2c0af8e661..110abd5ef9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -101,6 +101,7 @@ 隱藏低播放量影片 隱藏低於指定播放量的影片 隱藏熱門的頂欄(排行榜等) + 隱藏熱門的話題 隱藏熱門的推薦關注(及其影片) 新增其他地區番劇 在首頁標籤新增大陸/港澳台番劇分頁 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9c93ae6c98..911b212d2c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -103,6 +103,7 @@ 隐藏低播放量视频 隐藏低于指定播放量的视频 隐藏热门的顶栏(排行榜等) + 隐藏热门的话题 隐藏热门的推荐关注(及其视频) 添加其他地区番剧 在首页标签添加大陆/港澳台番剧分页