From 7d927dde6bb93dfd4bd55ad13d5f9b40eb6649e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD-=E7=99=BD?= Date: Fri, 18 Nov 2022 12:05:20 +0800 Subject: [PATCH] Resolve #505 --- app/src/main/java/com/hippo/ehviewer/EhApplication.kt | 3 +++ app/src/main/java/com/hippo/ehviewer/Settings.java | 6 ++++++ app/src/main/res/values-zh-rCN/strings.xml | 3 ++- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/eh_settings.xml | 8 +++++++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/EhApplication.kt b/app/src/main/java/com/hippo/ehviewer/EhApplication.kt index 1875b50f7..be59de4a7 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhApplication.kt +++ b/app/src/main/java/com/hippo/ehviewer/EhApplication.kt @@ -170,6 +170,9 @@ class EhApplication : SceneApplication() { } fun showEventPane(html: String) { + if (Settings.getHideHvEvents() && html.contains("You have encountered a monster!")) { + return; + } val activity = topActivity activity?.runOnUiThread { val dialog = BaseDialogBuilder(activity) diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java index 5ecb90864..f3e5e9794 100755 --- a/app/src/main/java/com/hippo/ehviewer/Settings.java +++ b/app/src/main/java/com/hippo/ehviewer/Settings.java @@ -67,6 +67,8 @@ public class Settings { public static final int DEFAULT_DEFAULT_CATEGORIES = EhConfig.ALL_CATEGORY; public static final String KEY_EXCLUDED_TAG_NAMESPACES = "excluded_tag_namespaces"; public static final String KEY_EXCLUDED_LANGUAGES = "excluded_languages"; + private static final String KEY_HIDE_HV_EVENTS = "hide_hv_events"; + private static final boolean DEFAULT_HIDE_HV_EVENTS = true; /******************** ****** Privacy and Security ********************/ @@ -551,6 +553,10 @@ public class Settings { return getBoolean(KEY_REQUEST_NEWS, DEFAULT_REQUEST_NEWS); } + public static boolean getHideHvEvents() { + return getBoolean(KEY_HIDE_HV_EVENTS, DEFAULT_HIDE_HV_EVENTS); + } + public static boolean getShowJpnTitle() { return getBoolean(KEY_SHOW_JPN_TITLE, DEFAULT_SHOW_JPN_TITLE); } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index c7bc2b7da..4694290b9 100755 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -609,7 +609,8 @@ 流量计费网络警告 正在使用流量计费网络 从第 %d 页阅读 - 启动时请求新闻页面 + 启动时请求新闻页面 + 隐藏 HV 事件通知 复制翻译 恢复默认路径 选择新路径 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 07f783110..2f36d07cd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -604,7 +604,7 @@ 流量計費網路警告 正在使用流量計費網路 從第 %d 頁閱讀 - 啟動時請求新聞頁面 + 啟動時請求新聞頁面 複製翻譯 恢復預設路徑 選擇新路徑 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9dd8d9f0c..06befc6ee 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -672,7 +672,8 @@ Metered network warning Connected to metered networks Read page %d - Request news page on start + Request news page on start + Hide HV event Notifications Copy translation Reset to default Pick a new location diff --git a/app/src/main/res/xml/eh_settings.xml b/app/src/main/res/xml/eh_settings.xml index 7c973b012..b03579088 100644 --- a/app/src/main/res/xml/eh_settings.xml +++ b/app/src/main/res/xml/eh_settings.xml @@ -173,7 +173,13 @@ + +