From b00d857ec07cf9e14183bb2f544b26ef7a75fe08 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 21 Oct 2020 21:36:14 +0800 Subject: [PATCH 1/7] =?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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index c0287ef2d..18b66bd0f 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,10 @@ * 关注合作公众号 **[小说拾遗]()** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 +**2020/10/22** +* 修复选择错误的bug +* 修复长图最后一张不能滚动的bug + **2020/10/21** * 默认分组无书籍时自动隐藏 * 自定义翻页按键支持多个按键 From 646958ecd0a4dd0cee48049b5e7cfd5c056ec523 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 21 Oct 2020 21:57:59 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/ReadMenu.kt | 5 ++--- .../anima/explosion_field/ExplosionView.kt | 22 +++---------------- 2 files changed, 5 insertions(+), 22 deletions(-) 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 40af2c32d..d1480ac81 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 @@ -26,9 +26,8 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick */ class ReadMenu @JvmOverloads constructor( context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr) { + attrs: AttributeSet? = null +) : FrameLayout(context, attrs) { var cnaShowMenu: Boolean = false private val callBack: CallBack? get() = activity as? CallBack private lateinit var menuTopIn: Animation diff --git a/app/src/main/java/io/legado/app/ui/widget/anima/explosion_field/ExplosionView.kt b/app/src/main/java/io/legado/app/ui/widget/anima/explosion_field/ExplosionView.kt index 9eef530f2..7345e7ed9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/anima/explosion_field/ExplosionView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/anima/explosion_field/ExplosionView.kt @@ -30,7 +30,8 @@ import java.util.* @Suppress("unused") -class ExplosionView : View { +class ExplosionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + View(context, attrs) { private var customDuration = ExplosionAnimator.DEFAULT_DURATION private var idPlayAnimationEffect = 0 @@ -40,24 +41,7 @@ class ExplosionView : View { private val mExplosions = ArrayList() private val mExpandInset = IntArray(2) - constructor(context: Context) : super(context) { - init() - } - - constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init() - } - - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super( - context, - attrs, - defStyleAttr - ) { - init() - } - - private fun init() { - + init { Arrays.fill(mExpandInset, Utils.dp2Px(32)) } From 8554aed5434fa5b74b58d8de6a5824b974cfdd8c Mon Sep 17 00:00:00 2001 From: 10bits Date: Wed, 21 Oct 2020 11:15:52 -0500 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=91=E7=8E=B0?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=82=B9=E5=87=BB=E5=8A=A0=E8=BD=BD=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/explore/ExploreShowActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt index 5a6248869..270e7e703 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt @@ -40,9 +40,9 @@ class ExploreShowActivity : VMBaseActivity(R.layout.activi loadMoreView.startLoad() loadMoreView.setOnClickListener { if (!isLoading) { - isLoading = true loadMoreView.hasMore() scrollToBottom() + isLoading = true } } recycler_view.addOnScrollListener(object : RecyclerView.OnScrollListener() { From 3cb703d88be5a25affcc9002c3d8ab3554c39eff Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 22 Oct 2020 08:30:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/model/analyzeRule/AnalyzeRule.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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 8fb5e2c0f..11dcbab2c 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 @@ -649,16 +649,12 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { * 章节数转数字 */ fun toNumChapter(s: String?): String? { - if (s == null) { - return null - } - val pattern = Pattern.compile("(第)(.+?)(章)") - val matcher = pattern.matcher(s) - return if (matcher.find()) { - matcher.group(1)!! + StringUtils.stringToInt(matcher.group(2)) + matcher.group(3) - } else { - s + s ?: return null + val matcher = titleNumPattern.matcher(s) + if (matcher.find()) { + return "${matcher.group(1)}${StringUtils.stringToInt(matcher.group(2))}${matcher.group(3)}" } + return s } companion object { @@ -667,6 +663,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { private val evalPattern = Pattern.compile("@get:\\{[^}]+?\\}|\\{\\{[\\w\\W]*?\\}\\}", Pattern.CASE_INSENSITIVE) private val regexPattern = Pattern.compile("\\$\\d{1,2}") + private val titleNumPattern = Pattern.compile("(第)(.+?)(章)") } } From a9e2f98f8dd2589d0c6a349cf5ec3ba5435a7fe5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 22 Oct 2020 09:27:43 +0800 Subject: [PATCH 5/7] =?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/java/io/legado/app/App.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index 64f037fa4..d6bdb24f5 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -7,7 +7,6 @@ import android.content.res.Configuration import android.graphics.Color import android.os.Build import android.provider.Settings -import android.util.Log import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatDelegate import androidx.multidex.MultiDexApplication From 1c4c922e20f4f68f45bc1cb9ac2963aa57de634d Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 22 Oct 2020 09:43:01 +0800 Subject: [PATCH 6/7] =?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/java/io/legado/app/App.kt | 72 ++----------------- .../java/io/legado/app/help/ThemeConfig.kt | 60 ++++++++++++++++ .../app/ui/config/ThemeConfigFragment.kt | 2 +- 3 files changed, 65 insertions(+), 69 deletions(-) diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index d6bdb24f5..02dd32dae 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -4,7 +4,6 @@ import android.app.NotificationChannel import android.app.NotificationManager import android.content.Context import android.content.res.Configuration -import android.graphics.Color import android.os.Build import android.provider.Settings import androidx.annotation.RequiresApi @@ -15,14 +14,10 @@ import io.legado.app.constant.AppConst.channelIdDownload import io.legado.app.constant.AppConst.channelIdReadAloud import io.legado.app.constant.AppConst.channelIdWeb import io.legado.app.constant.EventBus -import io.legado.app.constant.PreferKey import io.legado.app.data.AppDatabase -import io.legado.app.help.ActivityHelp -import io.legado.app.help.AppConfig -import io.legado.app.help.CrashHandler -import io.legado.app.help.ReadBookConfig -import io.legado.app.lib.theme.ThemeStore -import io.legado.app.utils.* +import io.legado.app.help.* +import io.legado.app.utils.LanguageUtils +import io.legado.app.utils.postEvent @Suppress("DEPRECATION") class App : MultiDexApplication() { @@ -71,68 +66,9 @@ class App : MultiDexApplication() { } } - /** - * 更新主题 - */ - fun applyTheme() { - when { - AppConfig.isEInkMode -> { - ThemeStore.editTheme(this) - .coloredNavigationBar(true) - .primaryColor(Color.WHITE) - .accentColor(Color.BLACK) - .backgroundColor(Color.WHITE) - .bottomBackground(Color.WHITE) - .apply() - } - AppConfig.isNightTheme -> { - val primary = - getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) - val accent = - getPrefInt(PreferKey.cNAccent, getCompatColor(R.color.md_deep_orange_800)) - var background = - getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.md_grey_900)) - if (ColorUtils.isColorLight(background)) { - background = getCompatColor(R.color.md_grey_900) - putPrefInt(PreferKey.cNBackground, background) - } - val bBackground = - getPrefInt(PreferKey.cNBBackground, getCompatColor(R.color.md_grey_850)) - ThemeStore.editTheme(this) - .coloredNavigationBar(true) - .primaryColor(ColorUtils.withAlpha(primary, 1f)) - .accentColor(ColorUtils.withAlpha(accent, 1f)) - .backgroundColor(ColorUtils.withAlpha(background, 1f)) - .bottomBackground(ColorUtils.withAlpha(bBackground, 1f)) - .apply() - } - else -> { - val primary = - getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_brown_500)) - val accent = - getPrefInt(PreferKey.cAccent, getCompatColor(R.color.md_red_600)) - var background = - getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100)) - if (!ColorUtils.isColorLight(background)) { - background = getCompatColor(R.color.md_grey_100) - putPrefInt(PreferKey.cBackground, background) - } - val bBackground = - getPrefInt(PreferKey.cBBackground, getCompatColor(R.color.md_grey_200)) - ThemeStore.editTheme(this) - .coloredNavigationBar(true) - .primaryColor(ColorUtils.withAlpha(primary, 1f)) - .accentColor(ColorUtils.withAlpha(accent, 1f)) - .backgroundColor(ColorUtils.withAlpha(background, 1f)) - .bottomBackground(ColorUtils.withAlpha(bBackground, 1f)) - .apply() - } - } - } - fun applyDayNight() { ReadBookConfig.upBg() - applyTheme() + ThemeConfig.applyTheme(this) initNightMode() postEvent(EventBus.RECREATE, "") } diff --git a/app/src/main/java/io/legado/app/help/ThemeConfig.kt b/app/src/main/java/io/legado/app/help/ThemeConfig.kt index 44948e17c..74a42a2ed 100644 --- a/app/src/main/java/io/legado/app/help/ThemeConfig.kt +++ b/app/src/main/java/io/legado/app/help/ThemeConfig.kt @@ -7,6 +7,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey +import io.legado.app.lib.theme.ThemeStore import io.legado.app.utils.* import java.io.File @@ -137,6 +138,65 @@ object ThemeConfig { addConfig(config) } + /** + * 更新主题 + */ + fun applyTheme(context: Context) = with(context) { + when { + AppConfig.isEInkMode -> { + ThemeStore.editTheme(this) + .coloredNavigationBar(true) + .primaryColor(Color.WHITE) + .accentColor(Color.BLACK) + .backgroundColor(Color.WHITE) + .bottomBackground(Color.WHITE) + .apply() + } + AppConfig.isNightTheme -> { + val primary = + getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) + val accent = + getPrefInt(PreferKey.cNAccent, getCompatColor(R.color.md_deep_orange_800)) + var background = + getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.md_grey_900)) + if (ColorUtils.isColorLight(background)) { + background = getCompatColor(R.color.md_grey_900) + putPrefInt(PreferKey.cNBackground, background) + } + val bBackground = + getPrefInt(PreferKey.cNBBackground, getCompatColor(R.color.md_grey_850)) + ThemeStore.editTheme(this) + .coloredNavigationBar(true) + .primaryColor(ColorUtils.withAlpha(primary, 1f)) + .accentColor(ColorUtils.withAlpha(accent, 1f)) + .backgroundColor(ColorUtils.withAlpha(background, 1f)) + .bottomBackground(ColorUtils.withAlpha(bBackground, 1f)) + .apply() + } + else -> { + val primary = + getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_brown_500)) + val accent = + getPrefInt(PreferKey.cAccent, getCompatColor(R.color.md_red_600)) + var background = + getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100)) + if (!ColorUtils.isColorLight(background)) { + background = getCompatColor(R.color.md_grey_100) + putPrefInt(PreferKey.cBackground, background) + } + val bBackground = + getPrefInt(PreferKey.cBBackground, getCompatColor(R.color.md_grey_200)) + ThemeStore.editTheme(this) + .coloredNavigationBar(true) + .primaryColor(ColorUtils.withAlpha(primary, 1f)) + .accentColor(ColorUtils.withAlpha(accent, 1f)) + .backgroundColor(ColorUtils.withAlpha(background, 1f)) + .bottomBackground(ColorUtils.withAlpha(bBackground, 1f)) + .apply() + } + } + } + @Keep class Config( var themeName: String, 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 4b76ebc3e..0912da631 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 @@ -203,7 +203,7 @@ class ThemeConfigFragment : BasePreferenceFragment(), private fun upTheme(isNightTheme: Boolean) { if (AppConfig.isNightTheme == isNightTheme) { listView.post { - App.INSTANCE.applyTheme() + ThemeConfig.applyTheme(requireContext()) recreateActivities() } } From e5b7f3abe291b591b1a4f6ae024f0f324028a34b Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 22 Oct 2020 09:44:30 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/config/ThemeConfigFragment.kt | 2 +- app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) 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 0912da631..9b5d38e30 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 @@ -177,7 +177,7 @@ class ThemeConfigFragment : BasePreferenceFragment(), @SuppressLint("InflateParams") private fun saveThemeAlert(key: String) { - alert("主题名称") { + alert(R.string.theme_name) { var editText: AutoCompleteTextView? = null customView { layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index d5d78e8a8..598a5577d 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -770,5 +770,6 @@ 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. + 主题名称 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 16a4e98a8..17b939c02 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -770,5 +770,6 @@ 關注公眾號[开源阅读]獲取訂閱源! 目前沒有發現源,關注公眾號[开源阅读]添加包含發現的書源! 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. + 主题名称 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index a8d2982f2..18c518d9c 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -773,5 +773,6 @@ 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. + 主题名称 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e132ccf76..cdb9bc509 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -776,5 +776,6 @@ 关注公众号[开源阅读]获取订阅源! 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. + 主题名称