diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 1ed90388a..75f838848 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,6 +11,12 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2022/01/26** + +* 修复web写源订阅源保存失败bug +* http朗读下载错误连续5次后自动暂停 +* 其它一些优化 + **2022/01/20** * 添加payAction规则,返回购买链接 diff --git a/app/src/main/assets/web/rssSource/index.js b/app/src/main/assets/web/rssSource/index.js index 95a80a588..0be9448a1 100644 --- a/app/src/main/assets/web/rssSource/index.js +++ b/app/src/main/assets/web/rssSource/index.js @@ -84,7 +84,7 @@ function rule2json() { RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.enableJs = RuleJSON.enableJs == '' || String(RuleJSON.enableJs).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.loadWithBaseUrl = RuleJSON.loadWithBaseUrl == '' || String(RuleJSON.loadWithBaseUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; - RuleJSON.singleUrl = RuleJSON.singleUrl == '' || String(RuleJSON.singleUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; + RuleJSON.singleUrl = String(RuleJSON.singleUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; return RuleJSON; } // 将源对象填充到源表单 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 0e0664565..bfd935ef0 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -163,6 +163,12 @@ object ReadBookConfig { val config get() = if (shareLayout) shareConfig else durConfig + var bgAlpha: Int + get() = config.bgAlpha + set(value) { + config.bgAlpha = value + } + var pageAnim: Int get() = config.curPageAnim() set(value) { @@ -419,7 +425,8 @@ object ReadBookConfig { var name: String = "", var bgStr: String = "#EEEEEE",//白天背景 var bgStrNight: String = "#000000",//夜间背景 - var bgStrEInk: String = "#FFFFFF", + var bgStrEInk: String = "#FFFFFF",//EInk背景 + var bgAlpha: Int = 100,//背景透明度 var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片 var bgTypeNight: Int = 0,//夜间背景类型 var bgTypeEInk: Int = 0, diff --git a/app/src/main/java/io/legado/app/lib/theme/ThemeUtils.kt b/app/src/main/java/io/legado/app/lib/theme/ThemeUtils.kt index 267c5cc67..198c3ad89 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ThemeUtils.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ThemeUtils.kt @@ -33,7 +33,6 @@ object ThemeUtils { } } - @JvmOverloads fun resolveDrawable(context: Context, @AttrRes attr: Int): Drawable? { val a = context.theme.obtainStyledAttributes(intArrayOf(attr)) return try { diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index b14f43d98..79f073b3b 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -180,22 +180,26 @@ class HttpReadAloudService : BaseReadAloudService(), is SocketTimeoutException, is ConnectException -> { removeSpeakCache(fileName) downloadErrorNo++ - if (playErrorNo > 5) { - downloadErrorNo = 0 - createSilentSound(fileName) + if (downloadErrorNo > 5) { val msg = "tts超时或连接错误超过5次\n${it.localizedMessage}" AppLog.put(msg, it) toastOnUi(msg) + pauseReadAloud(true) } else { downloadAudio() } } else -> { removeSpeakCache(fileName) - createSilentSound(fileName) + downloadErrorNo++ val msg = "tts下载错误\n${it.localizedMessage}" AppLog.put(msg, it) Timber.e(it) + if (downloadErrorNo > 5) { + pauseReadAloud(true) + } else { + createSilentSound(fileName) + } } } } 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 28ba6e57f..136aa71f5 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 @@ -1005,6 +1005,7 @@ class ReadBookActivity : BaseReadBookActivity(), upSystemUiVisibility() readView.upBg() readView.upStyle() + readView.upBgAlpha() if (it) { ReadBook.loadContent(resetPageOffset = false) } else { 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 438839367..fdc01bd8a 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 @@ -9,6 +9,7 @@ import android.view.Gravity import android.view.View import android.view.ViewGroup import android.view.WindowManager +import android.widget.SeekBar import androidx.documentfile.provider.DocumentFile import com.jaredrummler.android.colorpicker.ColorPickerDialog import io.legado.app.R @@ -29,6 +30,7 @@ import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.lib.theme.getSecondaryTextColor import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.document.HandleFileContract +import io.legado.app.ui.widget.seekbar.SeekBarChangeListener import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding import timber.log.Timber @@ -108,6 +110,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) { ivImport.setColorFilter(primaryTextColor) ivExport.setColorFilter(primaryTextColor) ivDelete.setColorFilter(primaryTextColor) + tvBgAlpha.setTextColor(primaryTextColor) tvBgImage.setTextColor(primaryTextColor) recyclerView.adapter = adapter adapter.addHeaderView { @@ -130,6 +133,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) { private fun initData() = with(ReadBookConfig.durConfig) { binding.tvName.text = name.ifBlank { "文字" } binding.swDarkStatusIcon.isChecked = curStatusIconDark() + binding.sbBgAlpha.progress = bgAlpha } @SuppressLint("InflateParams") @@ -205,6 +209,15 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) { toastOnUi("数量已是最少,不能删除.") } } + binding.sbBgAlpha.setOnSeekBarChangeListener(object : SeekBarChangeListener { + override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { + ReadBookConfig.bgAlpha = progress + } + + override fun onStopTrackingTouch(seekBar: SeekBar) { + postEvent(EventBus.UP_CONFIG, false) + } + }) } @Suppress("BlockingMethodInNonBlockingContext") diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index f838c3166..8708e1175 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -185,7 +185,12 @@ class PageView(context: Context) : FrameLayout(context) { } fun setBg(bg: Drawable?) { - binding.pagePanel.background = bg + binding.vwBg.background = bg + upBgAlpha() + } + + fun upBgAlpha() { + binding.vwBg.alpha = ReadBookConfig.bgAlpha / 100f } fun upTime() { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt index 1cb59cb1a..baa394207 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt @@ -104,7 +104,7 @@ class ReadView(context: Context, attrs: AttributeSet) : } } - fun setRect9x() { + private fun setRect9x() { tlRect.set(0f, 0f, width * 0.33f, height * 0.33f) tcRect.set(width * 0.33f, 0f, width * 0.66f, height * 0.33f) trRect.set(width * 0.36f, 0f, width.toFloat(), height * 0.33f) @@ -534,6 +534,12 @@ class ReadView(context: Context, attrs: AttributeSet) : nextPage.setBg(ReadBookConfig.bg) } + fun upBgAlpha() { + curPage.upBgAlpha() + prevPage.upBgAlpha() + nextPage.upBgAlpha() + } + fun upTime() { curPage.upTime() prevPage.upTime() diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index 39f6617da..f80163368 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -30,7 +30,6 @@ import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.withContext diff --git a/app/src/main/res/layout/dialog_read_bg_text.xml b/app/src/main/res/layout/dialog_read_bg_text.xml index 73faa0c78..e2c2a2ee2 100644 --- a/app/src/main/res/layout/dialog_read_bg_text.xml +++ b/app/src/main/res/layout/dialog_read_bg_text.xml @@ -12,8 +12,8 @@ + android:gravity="center_vertical" + android:padding="6dp"> + app:tint="@color/secondaryText" /> + android:text="@string/dark_status_icon" + tools:ignore="TouchTargetSizeCheck" /> + + + + - + + + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent"/> + android:gravity="center_vertical" + app:layout_constraintTop_toBottomOf="@id/vw_status_bar"> + android:visibility="invisible" + app:layout_constraintTop_toBottomOf="@id/ll_header"/> + android:layout_weight="1" + app:layout_constraintTop_toBottomOf="@id/vw_top_divider" + app:layout_constraintBottom_toTopOf="@id/vw_bottom_divider"/> + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@id/ll_footer"/> + android:gravity="center_vertical" + app:layout_constraintBottom_toBottomOf="parent"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 38fb6435c..b2747bca2 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -913,5 +913,6 @@ 展开文本选择菜单 书籍保存位置 从其它应用打开的书籍保存位置 + 背景透明度 diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index ed121ea77..42a11b401 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -916,5 +916,6 @@ 展开文本选择菜单 书籍保存位置 从其它应用打开的书籍保存位置 + 背景透明度 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 60ec51145..79f653394 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -418,6 +418,7 @@ 目录列表规则(capítuloLista) 章节名称规则(capítuloNome) 章节URL规则(capítuloUrl) + 卷标识(isVolume) VIP标识(éVip) 更新时间(capítuloInfo) 正文规则(conteúdo) @@ -426,6 +427,7 @@ 资源正则(fonteRegex) 替换规则(substRegex) 图片样式(imagemFormato) + 购买操作(payAction) 图标(fonteÍcone) 列表规则(regrasArtigos) @@ -914,5 +916,6 @@ 展开文本选择菜单 书籍保存位置 从其它应用打开的书籍保存位置 + 背景透明度 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 4ea4750da..b3759c663 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -913,5 +913,6 @@ 展开文本选择菜单 书籍保存位置 从其它应用打开的书籍保存位置 + 背景透明度 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 2c163ac5d..5f4e69d82 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -915,5 +915,6 @@ 搜尋結果 書籍儲存位置 從其它應用程式打開的書籍儲存位置 + 背景透明度 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index bd023a0a0..5df8c8f4a 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -915,5 +915,6 @@ 展开文本选择菜单 书籍保存位置 从其它应用打开的书籍保存位置 + 背景透明度 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c71cc8598..ecec01576 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -418,7 +418,7 @@ 目录列表规则(chapterList) 章节名称规则(ChapterName) 章节URL规则(chapterUrl) - Volume标识(isVolume) + 卷标识(isVolume) VIP标识(isVip) 更新时间(ChapterInfo) 正文规则(content) @@ -919,6 +919,7 @@ 从其它应用打开的书籍保存位置 选择保存书籍的文件夹 用户代理 + 背景透明度 校验设置 diff --git a/build.gradle b/build.gradle index 3f4b6c700..ef8b49bf5 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { //maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } } dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'de.timfreiheit.resourceplaceholders:placeholders:0.4' classpath 'de.undercouch:gradle-download-task:4.1.2' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4a88e2259..637d848e9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri May 07 15:24:46 CST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME