diff --git a/app/src/main/assets/httpTTS.json b/app/src/main/assets/httpTTS.json index 29fda4c6f..a249a3b29 100644 --- a/app/src/main/assets/httpTTS.json +++ b/app/src/main/assets/httpTTS.json @@ -12,7 +12,7 @@ { "id": 1598233029306, "name": "度逍遥", - "url": "http://tts.baidu.com/text2audio,{\n \"method\": \"POST\",\n \"body\": \"tex={{java.encodeURI(java.encodeURI(speakText))}}&spd={{String((speakSpeed + 5) / 10 + 4)}}&per=3&cuid=baidu_speech_demo&idx=1&cod=2&lan=zh&ctp=1&pdt=1&vol=5&pit=5&_res_tag_=audio\"\n}" + "url": "http://tts.baidu.com/text2audio,{\n \"method\": \"POST\",\n \"body\": \"tex={{java.encodeURI(java.encodeURI(speakText))}}&spd={{String((speakSpeed + 5) / 10 + 4)}}&per=5003&cuid=baidu_speech_demo&idx=1&cod=2&lan=zh&ctp=1&pdt=1&vol=5&pit=5&_res_tag_=audio\"\n}" }, { "id": 1598233029307, diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index a182e7c52..33369c847 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,11 @@ * 关注合作公众号 **[小说拾遗]()** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 +**2020/10/16** +* 修复排版导入背景失败bug +* 修改默认度逍遥per为5003,需要重新导入默认 +* 优化规则解析 + **2020/10/14** * 优化替换规则编辑界面 * 修复网格书架间距变大bug diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 6e3557231..94eb04ee5 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -42,7 +42,7 @@ object ReadBookConfig { var bg: Drawable? = null var bgMeanColor: Int = 0 - val textColor: Int get() = durConfig.textColor() + val textColor: Int get() = durConfig.curTextColor() init { initConfigs() @@ -93,7 +93,7 @@ object ReadBookConfig { val dm = resources.displayMetrics val width = dm.widthPixels val height = dm.heightPixels - bg = durConfig.bgDrawable(width, height).apply { + bg = durConfig.curBgDrawable(width, height).apply { if (this is BitmapDrawable) { bgMeanColor = BitmapUtils.getMeanColor(bitmap) } else if (this is ColorDrawable) { @@ -168,9 +168,9 @@ object ReadBookConfig { val config get() = if (shareLayout) shareConfig else durConfig var pageAnim: Int - get() = config.pageAnim() + get() = config.curPageAnim() set(value) { - config.setPageAnim(value) + config.setCurPageAnim(value) isScroll = pageAnim == 3 } @@ -365,12 +365,12 @@ object ReadBookConfig { @Keep @Parcelize class Config( - private var bgStr: String = "#EEEEEE",//白天背景 - private var bgStrNight: String = "#000000",//夜间背景 - private var bgStrEInk: String = "#FFFFFF", - private var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片 - private var bgTypeNight: Int = 0,//夜间背景类型 - private var bgTypeEInk: Int = 0, + var bgStr: String = "#EEEEEE",//白天背景 + var bgStrNight: String = "#000000",//夜间背景 + var bgStrEInk: String = "#FFFFFF", + var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片 + var bgTypeNight: Int = 0,//夜间背景类型 + var bgTypeEInk: Int = 0, private var darkStatusIcon: Boolean = true,//白天是否暗色状态栏 private var darkStatusIconNight: Boolean = false,//晚上是否暗色状态栏 private var darkStatusIconEInk: Boolean = true, @@ -413,24 +413,8 @@ object ReadBookConfig { var hideHeader: Boolean = true, var hideFooter: Boolean = false ) : Parcelable { - fun setBg(bgType: Int, bg: String) { - when { - AppConfig.isEInkMode -> { - bgTypeEInk = bgType - bgStrEInk = bg - } - AppConfig.isNightTheme -> { - bgTypeNight = bgType - bgStrNight = bg - } - else -> { - this.bgType = bgType - bgStr = bg - } - } - } - fun setTextColor(color: Int) { + fun setCurTextColor(color: Int) { when { AppConfig.isEInkMode -> textColorEInk = "#${color.hexString}" AppConfig.isNightTheme -> textColorNight = "#${color.hexString}" @@ -439,7 +423,15 @@ object ReadBookConfig { ChapterProvider.upStyle() } - fun setStatusIconDark(isDark: Boolean) { + fun curTextColor(): Int { + return when { + AppConfig.isEInkMode -> Color.parseColor(textColorEInk) + AppConfig.isNightTheme -> Color.parseColor(textColorNight) + else -> Color.parseColor(textColor) + } + } + + fun setCurStatusIconDark(isDark: Boolean) { when { AppConfig.isEInkMode -> darkStatusIconEInk = isDark AppConfig.isNightTheme -> darkStatusIconNight = isDark @@ -447,7 +439,7 @@ object ReadBookConfig { } } - fun statusIconDark(): Boolean { + fun curStatusIconDark(): Boolean { return when { AppConfig.isEInkMode -> darkStatusIconEInk AppConfig.isNightTheme -> darkStatusIconNight @@ -455,29 +447,38 @@ object ReadBookConfig { } } - fun setPageAnim(anim: Int) { + fun setCurPageAnim(anim: Int) { when { AppConfig.isEInkMode -> pageAnimEInk = anim else -> pageAnim = anim } } - fun pageAnim(): Int { + fun curPageAnim(): Int { return when { AppConfig.isEInkMode -> pageAnimEInk else -> pageAnim } } - fun textColor(): Int { - return when { - AppConfig.isEInkMode -> Color.parseColor(textColorEInk) - AppConfig.isNightTheme -> Color.parseColor(textColorNight) - else -> Color.parseColor(textColor) + fun setCurBg(bgType: Int, bg: String) { + when { + AppConfig.isEInkMode -> { + bgTypeEInk = bgType + bgStrEInk = bg + } + AppConfig.isNightTheme -> { + bgTypeNight = bgType + bgStrNight = bg + } + else -> { + this.bgType = bgType + bgStr = bg + } } } - fun bgStr(): String { + fun curBgStr(): String { return when { AppConfig.isEInkMode -> bgStrEInk AppConfig.isNightTheme -> bgStrNight @@ -485,7 +486,7 @@ object ReadBookConfig { } } - fun bgType(): Int { + fun curBgType(): Int { return when { AppConfig.isEInkMode -> bgTypeEInk AppConfig.isNightTheme -> bgTypeNight @@ -493,18 +494,18 @@ object ReadBookConfig { } } - fun bgDrawable(width: Int, height: Int): Drawable { + fun curBgDrawable(width: Int, height: Int): Drawable { var bgDrawable: Drawable? = null val resources = App.INSTANCE.resources try { - bgDrawable = when (bgType()) { - 0 -> ColorDrawable(Color.parseColor(bgStr())) + bgDrawable = when (curBgType()) { + 0 -> ColorDrawable(Color.parseColor(curBgStr())) 1 -> { BitmapDrawable( resources, BitmapUtils.decodeAssetsBitmap( App.INSTANCE, - "bg" + File.separator + bgStr(), + "bg" + File.separator + curBgStr(), width, height ) @@ -512,7 +513,7 @@ object ReadBookConfig { } else -> BitmapDrawable( resources, - BitmapUtils.decodeBitmap(bgStr(), width, height) + BitmapUtils.decodeBitmap(curBgStr(), width, height) ) } } catch (e: Exception) { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt index 40fed86e0..e4c2829e8 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt @@ -10,13 +10,12 @@ import java.util.regex.Pattern @Keep class AnalyzeByJSonPath { - private var ctx: ReadContext? = null + private lateinit var ctx: ReadContext fun parse(json: Any): AnalyzeByJSonPath { - ctx = if (json is String) { - JsonPath.parse(json) - } else { - JsonPath.parse(json) + ctx = when (json) { + is String -> JsonPath.parse(json) + else -> JsonPath.parse(json) } return this } @@ -35,9 +34,9 @@ class AnalyzeByJSonPath { } if (rules.size == 1) { if (!rule.contains("{$.")) { - ctx?.let { - result = try { - val ob = it.read(rule) + try { + val ob = ctx.read(rule) + result = if (ob is List<*>) { val builder = StringBuilder() for (o in ob) { @@ -47,9 +46,7 @@ class AnalyzeByJSonPath { } else { ob.toString() } - } catch (ignored: Exception) { - rule - } + } catch (ignored: Exception) { } return result } else { @@ -100,7 +97,7 @@ class AnalyzeByJSonPath { if (rules.size == 1) { if (!rule.contains("{$.")) { try { - val obj = ctx!!.read(rule) ?: return result + val obj = ctx.read(rule) ?: return result if (obj is List<*>) { for (o in obj) result.add(o.toString()) @@ -108,7 +105,6 @@ class AnalyzeByJSonPath { result.add(obj.toString()) } } catch (ignored: Exception) { - result.add(rule) } return result } else { @@ -152,7 +148,7 @@ class AnalyzeByJSonPath { } internal fun getObject(rule: String): Any { - return ctx!!.read(rule) + return ctx.read(rule) } internal fun getList(rule: String): ArrayList? { @@ -175,7 +171,7 @@ class AnalyzeByJSonPath { } } if (rules.size == 1) { - ctx?.let { + ctx.let { try { return it.read>(rules[0]) } catch (e: Exception) { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt index bf00f0d43..cdfa03d7b 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt @@ -18,19 +18,17 @@ import java.util.* */ @Keep class AnalyzeByJSoup { - private var element: Element? = null + companion object { + val validKeys = arrayOf("class", "id", "tag", "text", "children") + } + + private lateinit var element: Element fun parse(doc: Any): AnalyzeByJSoup { - element = if (doc is Element) { - doc - } else if (doc is JXNode) { - if (doc.isElement) { - doc.asElement() - } else { - Jsoup.parse(doc.value().toString()) - } - } else { - Jsoup.parse(doc.toString()) + element = when (doc) { + is Element -> doc + is JXNode -> if (doc.isElement) doc.asElement() else Jsoup.parse(doc.toString()) + else -> Jsoup.parse(doc.toString()) } return this } @@ -79,7 +77,7 @@ class AnalyzeByJSoup { //拆分规则 val sourceRule = SourceRule(ruleStr) if (isEmpty(sourceRule.elementsRule)) { - textS.add(element?.data() ?: "") + textS.add(element.data() ?: "") } else { val elementsType: String val ruleStrS: Array @@ -103,7 +101,7 @@ class AnalyzeByJSoup { temp = if (sourceRule.isCss) { val lastIndex = ruleStrX.lastIndexOf('@') getResultLast( - element!!.select(ruleStrX.substring(0, lastIndex)), + element.select(ruleStrX.substring(0, lastIndex)), ruleStrX.substring(lastIndex + 1) ) } else { @@ -232,18 +230,18 @@ class AnalyzeByJSoup { elements.addAll(es) } } else { - val rulePcx = rule.splitNotBlank("!") - val rulePc = - rulePcx[0].trim { it <= ' ' }.splitNotBlank(">") - val rules = - rulePc[0].trim { it <= ' ' }.splitNotBlank(".") + val rulePcx = rule.split("!") + val rulePc = rulePcx[0].trim { it <= ' ' }.split(">") + val rules = rulePc[0].trim { it <= ' ' }.split(".") var filterRules: Array? = null var needFilterElements = rulePc.size > 1 && !isEmpty(rulePc[1].trim { it <= ' ' }) if (needFilterElements) { - filterRules = rulePc[1].trim { it <= ' ' }.splitNotBlank(".") + filterRules = rulePc[1].trim { it <= ' ' }.split(".").toTypedArray() filterRules[0] = filterRules[0].trim { it <= ' ' } - val validKeys = listOf("class", "id", "tag", "text") - if (filterRules.size < 2 || !validKeys.contains(filterRules[0]) || isEmpty(filterRules[1].trim { it <= ' ' })) { + if (filterRules.size < 2 + || !validKeys.contains(filterRules[0]) + || filterRules[1].trim { it <= ' ' }.isEmpty() + ) { needFilterElements = false } filterRules[1] = filterRules[1].trim { it <= ' ' } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt index 0439713e8..db3e5129a 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt @@ -12,28 +12,15 @@ import java.util.* @Keep class AnalyzeByXPath { - private var jxDocument: JXDocument? = null - private var jxNode: JXNode? = null + private lateinit var jxNode: Any fun parse(doc: Any): AnalyzeByXPath { - if (doc is JXNode) { - jxNode = doc - if (jxNode?.isElement == false) { - jxDocument = strToJXDocument(doc.toString()) - jxNode = null - } - } else if (doc is Document) { - jxDocument = JXDocument.create(doc) - jxNode = null - } else if (doc is Element) { - jxDocument = JXDocument.create(Elements(doc)) - jxNode = null - } else if (doc is Elements) { - jxDocument = JXDocument.create(doc) - jxNode = null - } else { - jxDocument = strToJXDocument(doc.toString()) - jxNode = null + jxNode = when (doc) { + is JXNode -> if (doc.isElement) doc else strToJXDocument(doc.toString()) + is Document -> JXDocument.create(doc) + is Element -> JXDocument.create(Elements(doc)) + is Elements -> JXDocument.create(doc) + else -> strToJXDocument(doc.toString()) } return this } @@ -49,6 +36,15 @@ class AnalyzeByXPath { return JXDocument.create(html1) } + private fun getResult(xPath: String): List? { + val node = jxNode + return if (node is JXNode) { + node.sel(xPath) + } else { + (node as JXDocument).selN(xPath) + } + } + internal fun getElements(xPath: String): List? { if (TextUtils.isEmpty(xPath)) { return null @@ -71,7 +67,7 @@ class AnalyzeByXPath { } } if (rules.size == 1) { - return jxNode?.sel(rules[0]) ?: jxDocument?.selN(rules[0]) + return getResult(rules[0]) } else { val results = ArrayList>() for (rl in rules) { @@ -121,8 +117,7 @@ class AnalyzeByXPath { } } if (rules.size == 1) { - val jxNodes = jxNode?.sel(xPath) ?: jxDocument?.selN(xPath) - jxNodes?.map { + getResult(xPath)?.map { result.add(it.asString()) } return result @@ -167,9 +162,8 @@ class AnalyzeByXPath { elementsType = "|" } if (rules.size == 1) { - val jxNodes = jxNode?.sel(rule) ?: jxDocument?.selN(rule) - jxNodes?.let { - return TextUtils.join("\n", jxNodes) + getResult(rule)?.let { + return TextUtils.join("\n", it) } return null } else { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index bfc0f9781..cb8b9c6b9 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -461,7 +461,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { mode = Mode.Regex } splitRegex(tmp) - } else if (mode != Mode.Js && mode != Mode.Json && mode != Mode.Regex + } else if (mode != Mode.Js && mode != Mode.Regex && evalMatcher.start() == 0 ) { mode = Mode.Regex diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 3e06395cd..c7f860697 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -741,11 +741,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo override fun onColorSelected(dialogId: Int, color: Int) = with(ReadBookConfig.durConfig) { when (dialogId) { TEXT_COLOR -> { - setTextColor(color) + setCurTextColor(color) postEvent(EventBus.UP_CONFIG, false) } BG_COLOR -> { - setBg(0, "#${color.hexString}") + setCurBg(0, "#${color.hexString}") ReadBookConfig.upBg() postEvent(EventBus.UP_CONFIG, false) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt index 2b7e8fd82..adb8909e1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt @@ -59,7 +59,7 @@ object ReadBookActivityHelp { } window.decorView.systemUiVisibility = flag if (toolBarHide) { - ATH.setLightStatusBar(window, ReadBookConfig.durConfig.statusIconDark()) + ATH.setLightStatusBar(window, ReadBookConfig.durConfig.curStatusIconDark()) } else { ATH.setLightStatusBarAuto( window, diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index ab4f80c73..69070e27b 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -108,7 +108,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { @SuppressLint("InflateParams") private fun initData() = with(ReadBookConfig.durConfig) { - sw_dark_status_icon.isChecked = statusIconDark() + sw_dark_status_icon.isChecked = curStatusIconDark() adapter = BgAdapter(requireContext()) recycler_view.adapter = adapter val headerView = LayoutInflater.from(requireContext()) @@ -127,13 +127,13 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { private fun initEvent() = with(ReadBookConfig.durConfig) { sw_dark_status_icon.onCheckedChange { buttonView, isChecked -> if (buttonView?.isPressed == true) { - setStatusIconDark(isChecked) + setCurStatusIconDark(isChecked) (activity as? ReadBookActivity)?.upSystemUiVisibility() } } tv_text_color.onClick { ColorPickerDialog.newBuilder() - .setColor(textColor()) + .setColor(curTextColor()) .setShowAlphaSlider(false) .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogId(TEXT_COLOR) @@ -141,7 +141,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { } tv_bg_color.onClick { val bgColor = - if (bgType() == 0) Color.parseColor(bgStr()) + if (curBgType() == 0) Color.parseColor(curBgStr()) else Color.parseColor("#015A86") ColorPickerDialog.newBuilder() .setColor(bgColor) @@ -206,7 +206,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { holder.itemView.apply { this.onClick { getItemByLayoutPosition(holder.layoutPosition)?.let { - ReadBookConfig.durConfig.setBg(1, it) + ReadBookConfig.durConfig.setCurBg(1, it) ReadBookConfig.upBg() postEvent(EventBus.UP_CONFIG, false) } @@ -237,9 +237,27 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { exportFiles.add(fontExportFile) } } - if (ReadBookConfig.durConfig.bgType() == 2) { - val bgName = FileUtils.getName(ReadBookConfig.durConfig.bgStr()) - val bgFile = File(ReadBookConfig.durConfig.bgStr()) + if (ReadBookConfig.durConfig.bgType == 2) { + val bgName = FileUtils.getName(ReadBookConfig.durConfig.bgStr) + val bgFile = File(ReadBookConfig.durConfig.bgStr) + if (bgFile.exists()) { + val bgExportFile = File(FileUtils.getPath(configDir, bgName)) + bgFile.copyTo(bgExportFile) + exportFiles.add(bgExportFile) + } + } + if (ReadBookConfig.durConfig.bgTypeNight == 2) { + val bgName = FileUtils.getName(ReadBookConfig.durConfig.bgStrNight) + val bgFile = File(ReadBookConfig.durConfig.bgStrNight) + if (bgFile.exists()) { + val bgExportFile = File(FileUtils.getPath(configDir, bgName)) + bgFile.copyTo(bgExportFile) + exportFiles.add(bgExportFile) + } + } + if (ReadBookConfig.durConfig.bgTypeEInk == 2) { + val bgName = FileUtils.getName(ReadBookConfig.durConfig.bgStrEInk) + val bgFile = File(ReadBookConfig.durConfig.bgStrEInk) if (bgFile.exists()) { val bgExportFile = File(FileUtils.getPath(configDir, bgName)) bgFile.copyTo(bgExportFile) @@ -329,8 +347,28 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { } config.textFont = fontPath } - if (config.bgType() == 2) { - val bgName = FileUtils.getName(config.bgStr()) + if (config.bgType == 2) { + val bgName = FileUtils.getName(config.bgStr) + val bgPath = FileUtils.getPath(requireContext().externalFilesDir, "bg", bgName) + if (!FileUtils.exist(bgPath)) { + val bgFile = FileUtils.getFile(configDir, bgName) + if (bgFile.exists()) { + bgFile.copyTo(File(bgPath)) + } + } + } + if (config.bgTypeNight == 2) { + val bgName = FileUtils.getName(config.bgStrNight) + val bgPath = FileUtils.getPath(requireContext().externalFilesDir, "bg", bgName) + if (!FileUtils.exist(bgPath)) { + val bgFile = FileUtils.getFile(configDir, bgName) + if (bgFile.exists()) { + bgFile.copyTo(File(bgPath)) + } + } + } + if (config.bgTypeEInk == 2) { + val bgName = FileUtils.getName(config.bgStrEInk) val bgPath = FileUtils.getPath(requireContext().externalFilesDir, "bg", bgName) if (!FileUtils.exist(bgPath)) { val bgFile = FileUtils.getFile(configDir, bgName) @@ -387,7 +425,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { DocumentUtils.readBytes(requireContext(), doc.uri) }.getOrNull()?.let { byteArray -> file.writeBytes(byteArray) - ReadBookConfig.durConfig.setBg(2, file.absolutePath) + ReadBookConfig.durConfig.setCurBg(2, file.absolutePath) ReadBookConfig.upBg() postEvent(EventBus.UP_CONFIG, false) } ?: toast("获取文件出错") @@ -401,7 +439,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { .rationale(R.string.bg_image_per) .onGranted { RealPathUtil.getPath(requireContext(), uri)?.let { path -> - ReadBookConfig.durConfig.setBg(2, path) + ReadBookConfig.durConfig.setCurBg(2, path) ReadBookConfig.upBg() postEvent(EventBus.UP_CONFIG, false) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 7a0915ddd..4f3b2c1a0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -246,13 +246,13 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { payloads: MutableList ) { holder.itemView.apply { - iv_style.setTextColor(item.textColor()) - iv_style.setImageDrawable(item.bgDrawable(100, 150)) + iv_style.setTextColor(item.curTextColor()) + iv_style.setImageDrawable(item.curBgDrawable(100, 150)) if (ReadBookConfig.styleSelect == holder.layoutPosition) { iv_style.borderColor = accentColor iv_style.setTextBold(true) } else { - iv_style.borderColor = item.textColor() + iv_style.borderColor = item.curTextColor() iv_style.setTextBold(false) } } diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt index 75ac065e0..b1eab410e 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt @@ -5,7 +5,6 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import androidx.appcompat.widget.SearchView -import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.lib.theme.ATH @@ -44,7 +43,6 @@ class BookSourceDebugActivity : private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = BookSourceDebugAdapter(this) - recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter rotate_loading.loadingColor = accentColor } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt index b97bae3ea..b647c5ddf 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt @@ -1,7 +1,6 @@ package io.legado.app.ui.rss.source.debug import android.os.Bundle -import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.lib.theme.ATH @@ -40,7 +39,6 @@ class RssSourceDebugActivity : VMBaseActivity(R.layout.acti private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = RssSourceDebugAdapter(this) - recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter rotate_loading.loadingColor = accentColor } diff --git a/app/src/main/res/drawable/ic_last_read.xml b/app/src/main/res/drawable/ic_last_read.xml deleted file mode 100644 index 9a2791b42..000000000 --- a/app/src/main/res/drawable/ic_last_read.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/app/src/main/res/layout/activity_read_record.xml b/app/src/main/res/layout/activity_read_record.xml index 382d390bf..20b9d83d9 100644 --- a/app/src/main/res/layout/activity_read_record.xml +++ b/app/src/main/res/layout/activity_read_record.xml @@ -24,7 +24,7 @@ - + android:layout_height="match_parent" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> \ No newline at end of file diff --git a/app/src/main/res/menu/book_source.xml b/app/src/main/res/menu/book_source.xml index ed20f9b16..2e32f7c77 100644 --- a/app/src/main/res/menu/book_source.xml +++ b/app/src/main/res/menu/book_source.xml @@ -49,7 +49,7 @@ + android:title="@string/sort_by_lastUpdateTime" /> diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index b107331c7..1e6a0da5b 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -765,7 +765,7 @@ 使用保存主题,导入,分享主题 切換默認主題 分享選中書源 - 時間排序 + 時間排序 全文搜索 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index f6ba89777..33b1da7fe 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -765,7 +765,7 @@ 使用儲存主題,匯入,分享主題 切換預設主題 分享選中書源 - 時間排序 + 時間排序 全文搜尋 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 743147864..270f502de 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -768,7 +768,7 @@ 主题列表 使用保存主题,导入,分享主题 切换默认主题 - 时间排序 + 时间排序 全文搜索 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ad9af3df7..7c257fcfc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -771,7 +771,7 @@ Theme list Save, Import, Share theme Share selected sources - Sort by update time + Sort by update time Search content 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源!