pull/1581/head
kunfei 3 years ago
parent e2f1c497a8
commit c4dfb57341
  1. 8
      app/src/main/java/io/legado/app/constant/AppLog.kt
  2. 2
      app/src/main/java/io/legado/app/help/AppConfig.kt
  3. 2
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  4. 2
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
  5. 2
      app/src/main/java/io/legado/app/service/TTSReadAloudService.kt
  6. 5
      app/src/main/java/io/legado/app/utils/LogUtils.kt
  7. 2
      app/src/main/res/values-es-rES/strings.xml
  8. 4
      app/src/main/res/values-ja-rJP/strings.xml
  9. 4
      app/src/main/res/values-pt-rBR/strings.xml
  10. 2
      app/src/main/res/values-zh-rHK/strings.xml
  11. 2
      app/src/main/res/values-zh-rTW/strings.xml
  12. 2
      app/src/main/res/values-zh/strings.xml
  13. 3
      app/src/main/res/values/strings.xml
  14. 31
      app/src/main/res/xml/pref_config_other.xml

@ -1,5 +1,7 @@
package io.legado.app.constant package io.legado.app.constant
import io.legado.app.help.AppConfig
object AppLog { object AppLog {
private val mLogs = arrayListOf<Triple<Long, String, Throwable?>>() private val mLogs = arrayListOf<Triple<Long, String, Throwable?>>()
@ -20,4 +22,10 @@ object AppLog {
mLogs.clear() mLogs.clear()
} }
fun putDebug(message: String?, throwable: Throwable? = null) {
if (AppConfig.recordLog) {
put(message, throwable)
}
}
} }

@ -271,6 +271,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val replaceEnableDefault get() = appCtx.getPrefBoolean(PreferKey.replaceEnableDefault, true) val replaceEnableDefault get() = appCtx.getPrefBoolean(PreferKey.replaceEnableDefault, true)
val recordLog get() = appCtx.getPrefBoolean(PreferKey.recordLog)
val doublePageHorizontal: Boolean val doublePageHorizontal: Boolean
get() = appCtx.getPrefBoolean(PreferKey.doublePageHorizontal, true) get() = appCtx.getPrefBoolean(PreferKey.doublePageHorizontal, true)

@ -521,7 +521,7 @@ interface JsExtensions {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Timber.d(msg.toString()) Timber.d(msg.toString())
} }
AppLog.put(msg.toString()) AppLog.putDebug(msg.toString())
return msg return msg
} }

@ -64,8 +64,10 @@ class HttpReadAloudService : BaseReadAloudService(),
override fun play() { override fun play() {
if (contentList.isEmpty()) { if (contentList.isEmpty()) {
AppLog.putDebug("朗读列表为空")
ReadBook.readAloud() ReadBook.readAloud()
} else { } else {
super.play()
ReadAloud.httpTTS?.let { ReadAloud.httpTTS?.let {
val fileName = val fileName =
md5SpeakFileName(it.url, AppConfig.ttsSpeechRate.toString(), contentList[nowSpeak]) md5SpeakFileName(it.url, AppConfig.ttsSpeechRate.toString(), contentList[nowSpeak])

@ -5,6 +5,7 @@ import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener import android.speech.tts.UtteranceProgressListener
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.constant.AppLog
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
@ -68,6 +69,7 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
if (!ttsInitFinish) return if (!ttsInitFinish) return
if (!requestFocus()) return if (!requestFocus()) return
if (contentList.isEmpty()) { if (contentList.isEmpty()) {
AppLog.putDebug("朗读列表为空")
ReadBook.readAloud() ReadBook.readAloud()
} else { } else {
super.play() super.play()

@ -3,6 +3,7 @@
package io.legado.app.utils package io.legado.app.utils
import android.annotation.SuppressLint import android.annotation.SuppressLint
import io.legado.app.help.AppConfig
import splitties.init.appCtx import splitties.init.appCtx
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -43,7 +44,7 @@ object LogUtils {
return (getCurrentDateStr(TIME_PATTERN) + ": " + record.message + "\n") return (getCurrentDateStr(TIME_PATTERN) + ": " + record.message + "\n")
} }
} }
level = if (appCtx.getPrefBoolean("recordLog")) { level = if (AppConfig.recordLog) {
Level.INFO Level.INFO
} else { } else {
Level.OFF Level.OFF
@ -52,7 +53,7 @@ object LogUtils {
} }
fun upLevel() { fun upLevel() {
fileHandler?.level = if (appCtx.getPrefBoolean("recordLog")) { fileHandler?.level = if (AppConfig.recordLog) {
Level.INFO Level.INFO
} else { } else {
Level.OFF Level.OFF

@ -873,6 +873,7 @@
<string name="path">路径</string> <string name="path">路径</string>
<string name="direct_link_upload_rule">直链上传规则</string> <string name="direct_link_upload_rule">直链上传规则</string>
<string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string> <string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
@ -925,5 +926,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -640,7 +640,7 @@
<string name="a10_permission_toast">Android 10+ unable to read and write file due to permission restrictions</string> <string name="a10_permission_toast">Android 10+ unable to read and write file due to permission restrictions</string>
<string name="add_to_text_context_menu_s">Long tap to display Legado·Search in the operation menu</string> <string name="add_to_text_context_menu_s">Long tap to display Legado·Search in the operation menu</string>
<string name="add_to_text_context_menu_t">Text operation display Search</string> <string name="add_to_text_context_menu_t">Text operation display Search</string>
<string name="record_log">Log</string> <string name="record_log">Record log</string>
<string name="log">Log</string> <string name="log">Log</string>
<string name="chinese_converter">Simplified conversion</string> <string name="chinese_converter">Simplified conversion</string>
<string name="change_icon_error">The icon is a vector icon, which was not supported before Android 8.0</string> <string name="change_icon_error">The icon is a vector icon, which was not supported before Android 8.0</string>
@ -876,6 +876,7 @@
<string name="path">路径</string> <string name="path">路径</string>
<string name="direct_link_upload_rule">直链上传规则</string> <string name="direct_link_upload_rule">直链上传规则</string>
<string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string> <string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
@ -928,5 +929,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -640,7 +640,7 @@
<string name="a10_permission_toast">Android 10+ não é capaz de ler e salvar arquivos devido a restrições de permissão</string> <string name="a10_permission_toast">Android 10+ não é capaz de ler e salvar arquivos devido a restrições de permissão</string>
<string name="add_to_text_context_menu_s">Clique longo para exibir o Legado·Pesquisa no menu de operação</string> <string name="add_to_text_context_menu_s">Clique longo para exibir o Legado·Pesquisa no menu de operação</string>
<string name="add_to_text_context_menu_t">Visualização da operação de texto na Pesquisa</string> <string name="add_to_text_context_menu_t">Visualização da operação de texto na Pesquisa</string>
<string name="record_log">Log</string> <string name="record_log">Record log</string>
<string name="log">Log</string> <string name="log">Log</string>
<string name="chinese_converter">Conversão simplificada</string> <string name="chinese_converter">Conversão simplificada</string>
<string name="change_icon_error">O ícone é um ícone vetorial, que não era suportado antes de Android 8.0</string> <string name="change_icon_error">O ícone é um ícone vetorial, que não era suportado antes de Android 8.0</string>
@ -876,6 +876,7 @@
<string name="path">路径</string> <string name="path">路径</string>
<string name="direct_link_upload_rule">直链上传规则</string> <string name="direct_link_upload_rule">直链上传规则</string>
<string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string> <string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
@ -928,5 +929,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -873,6 +873,7 @@
<string name="path">路徑</string> <string name="path">路徑</string>
<string name="direct_link_upload_rule">直鏈上傳規則</string> <string name="direct_link_upload_rule">直鏈上傳規則</string>
<string name="direct_link_upload_rule_summary">用於導出書源書單時生成直鏈url</string> <string name="direct_link_upload_rule_summary">用於導出書源書單時生成直鏈url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">複製播放Url</string> <string name="copy_play_url">複製播放Url</string>
<string name="set_source_variable">設置源變量</string> <string name="set_source_variable">設置源變量</string>
<string name="set_book_variable">設置書籍變量</string> <string name="set_book_variable">設置書籍變量</string>
@ -925,5 +926,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -875,6 +875,7 @@
<string name="path">路徑</string> <string name="path">路徑</string>
<string name="direct_link_upload_rule">直鏈上傳規則</string> <string name="direct_link_upload_rule">直鏈上傳規則</string>
<string name="direct_link_upload_rule_summary">用於匯出書源書單時生成直鏈url</string> <string name="direct_link_upload_rule_summary">用於匯出書源書單時生成直鏈url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">複製播放Url</string> <string name="copy_play_url">複製播放Url</string>
<string name="set_source_variable">設定源變數</string> <string name="set_source_variable">設定源變數</string>
<string name="set_book_variable">設定書籍變數</string> <string name="set_book_variable">設定書籍變數</string>
@ -927,5 +928,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -877,6 +877,7 @@
<string name="path">路径</string> <string name="path">路径</string>
<string name="direct_link_upload_rule">直链上传规则</string> <string name="direct_link_upload_rule">直链上传规则</string>
<string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string> <string name="direct_link_upload_rule_summary">用于导出书源书单时生成直链url</string>
<string name="direct_link_upload_config">直链上传配置</string>
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
@ -927,5 +928,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -640,7 +640,7 @@
<string name="a10_permission_toast">Android 10+ unable to read and write file due to permission restrictions</string> <string name="a10_permission_toast">Android 10+ unable to read and write file due to permission restrictions</string>
<string name="add_to_text_context_menu_s">Long tap to display Legado·Search in the operation menu</string> <string name="add_to_text_context_menu_s">Long tap to display Legado·Search in the operation menu</string>
<string name="add_to_text_context_menu_t">Text operation display Search</string> <string name="add_to_text_context_menu_t">Text operation display Search</string>
<string name="record_log">Log</string> <string name="record_log">Record log</string>
<string name="log">Log</string> <string name="log">Log</string>
<string name="chinese_converter">Simplified conversion</string> <string name="chinese_converter">Simplified conversion</string>
<string name="change_icon_error">The icon is a vector icon, which was not supported before Android 8.0</string> <string name="change_icon_error">The icon is a vector icon, which was not supported before Android 8.0</string>
@ -929,5 +929,6 @@
<string name="seconds"></string> <string name="seconds"></string>
<string name="less_than">小于</string> <string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string> <string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -3,9 +3,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<io.legado.app.ui.widget.prefs.NameListPreference <io.legado.app.ui.widget.prefs.NameListPreference
android:defaultValue="auto"
android:key="language" android:key="language"
android:title="@string/language" android:title="@string/language"
android:defaultValue="auto"
app:entries="@array/language" app:entries="@array/language"
app:entryValues="@array/language_value" /> app:entryValues="@array/language_value" />
@ -58,8 +58,8 @@
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="defaultBookTreeUri" android:key="defaultBookTreeUri"
android:title="@string/book_tree_uri_t" android:summary="@string/book_tree_uri_s"
android:summary="@string/book_tree_uri_s" /> android:title="@string/book_tree_uri_t" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="checkSource" android:key="checkSource"
@ -67,39 +67,39 @@
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="uploadRule" android:key="uploadRule"
android:title="@string/direct_link_upload_rule" android:summary="@string/direct_link_upload_rule_summary"
android:summary="@string/direct_link_upload_rule_summary" /> android:title="@string/direct_link_upload_rule" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:key="Cronet"
android:defaultValue="false" android:defaultValue="false"
android:title="Cronet" android:key="Cronet"
android:summary="@string/pref_cronet_summary" /> android:summary="@string/pref_cronet_summary"
android:title="Cronet" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="preDownloadNum" android:key="preDownloadNum"
android:title="@string/pre_download" android:summary="@string/pre_download_s"
android:summary="@string/pre_download_s" /> android:title="@string/pre_download" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="replaceEnableDefault" android:key="replaceEnableDefault"
android:title="@string/replace_enable_default_t"
android:summary="@string/replace_enable_default_s" android:summary="@string/replace_enable_default_s"
android:title="@string/replace_enable_default_t"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="mediaButtonOnExit" android:key="mediaButtonOnExit"
android:title="@string/media_button_on_exit_title"
android:summary="@string/media_button_on_exit_summary" android:summary="@string/media_button_on_exit_summary"
android:title="@string/media_button_on_exit_title"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="autoClearExpired" android:key="autoClearExpired"
android:title="@string/auto_clear_expired" android:summary="@string/auto_clear_expired_summary"
android:summary="@string/auto_clear_expired_summary" /> android:title="@string/auto_clear_expired" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="webPort" android:key="webPort"
@ -108,8 +108,8 @@
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="cleanCache" android:key="cleanCache"
android:title="@string/clear_cache"
android:summary="@string/clear_cache_summary" android:summary="@string/clear_cache_summary"
android:title="@string/clear_cache"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
@ -127,6 +127,7 @@
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="recordLog" android:key="recordLog"
android:summary="@string/record_debug_log"
android:title="@string/record_log" android:title="@string/record_log"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />

Loading…
Cancel
Save