From d979cf4aa161be6fcc58cbbdacceb0909cb1ed30 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 14 Sep 2021 20:44:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 16 +++----------- .../app/data/entities/rule/ContentRule.kt | 2 +- .../io/legado/app/ui/book/read/ReadMenu.kt | 2 ++ .../source/edit/BookSourceEditActivity.kt | 2 -- .../app/ui/config/ThemeConfigFragment.kt | 21 +++++++++++-------- 5 files changed, 18 insertions(+), 25 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index c42aba55b..f5343d84e 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -16,19 +16,9 @@ 1. 书架菜单添加了日志,更新失败的和下载失败的信息会显示在里面 2. 书源添加校验关键字,有校验关键字的书源用此关键字校验 -3. 正文规则添加操作规则,可执行js和打开网页,格式: - -```json -[ - { - "name": "购买", - "action": "http:xxxx" - } -] -``` - -4. 目录添加购买标识规则 -5. 正文标题使用替换,简繁转换,正文中已书名,标题开头的自动去重 +3. 目录添加购买标识规则 +4. 正文标题使用替换,简繁转换,正文中已书名,标题开头的自动去重 +5. 其它一些优化 **2021/09/08** diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt index 197845cea..4016c455e 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt @@ -11,5 +11,5 @@ data class ContentRule( var sourceRegex: String? = null, var replaceRegex: String? = null, //替换规则 var imageStyle: String? = null, //默认大小居中,FULL最大宽度 - var actions: String? = null //操作 + var payAction: String? = null, //购买操作,url/js ) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 7ac434ec3..706e162d5 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -143,9 +143,11 @@ class ReadMenu @JvmOverloads constructor( tvChapterUrl.setOnClickListener { context.openUrl(binding.tvChapterUrl.text.toString()) } + //登录 tvLogin.setOnClickListener { callBack.showLogin() } + //亮度跟随 ivBrightnessAuto.setOnClickListener { context.putPrefBoolean("brightnessAuto", !brightnessAuto()) upBrightnessState() diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index 786430e01..eb96a7115 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -275,7 +275,6 @@ class BookSourceEditActivity : add(EditEntity("sourceRegex", cr?.sourceRegex, R.string.rule_source_regex)) add(EditEntity("replaceRegex", cr?.replaceRegex, R.string.rule_replace_regex)) add(EditEntity("imageStyle", cr?.imageStyle, R.string.rule_image_style)) - add(EditEntity("actions", cr?.actions, R.string.rule_actions)) } binding.tabLayout.selectTab(binding.tabLayout.getTabAt(0)) setEditEntities(0) @@ -370,7 +369,6 @@ class BookSourceEditActivity : "sourceRegex" -> contentRule.sourceRegex = it.value "replaceRegex" -> contentRule.replaceRegex = it.value "imageStyle" -> contentRule.imageStyle = it.value - "actions" -> contentRule.actions = it.value } } source.ruleSearch = searchRule diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index c435146ae..ddead89b4 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -163,17 +163,19 @@ class ThemeConfigFragment : BasePreferenceFragment(), "saveDayTheme", "saveNightTheme" -> alertSaveTheme(key) PreferKey.bgImage -> selectBgAction(false) PreferKey.bgImageN -> selectBgAction(true) - PreferKey.defaultCover -> if (getPrefString(PreferKey.defaultCover).isNullOrEmpty()) { - selectImage.launch(requestCodeCover) - } else { - selector(items = arrayListOf("删除图片", "选择图片")) { _, i -> - if (i == 0) { - removePref(PreferKey.defaultCover) - } else { - selectImage.launch(requestCodeCover) + PreferKey.defaultCover -> + if (getPrefString(PreferKey.defaultCover).isNullOrEmpty()) { + selectImage.launch(requestCodeCover) + } else { + selector(items = arrayListOf("删除图片", "选择图片")) { _, i -> + if (i == 0) { + removePref(PreferKey.defaultCover) + CoverImageView.upDefaultCover() + } else { + selectImage.launch(requestCodeCover) + } } } - } PreferKey.defaultCoverDark -> if (getPrefString(PreferKey.defaultCoverDark).isNullOrEmpty()) { selectImage.launch(requestCodeCoverDark) @@ -181,6 +183,7 @@ class ThemeConfigFragment : BasePreferenceFragment(), selector(items = arrayListOf("删除图片", "选择图片")) { _, i -> if (i == 0) { removePref(PreferKey.defaultCoverDark) + CoverImageView.upDefaultCover() } else { selectImage.launch(requestCodeCoverDark) }