From 8dab4fe9978873ba80fd5d063eb3967451b76a9b Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 2 Mar 2021 22:42:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/about/AboutFragment.kt | 23 +++++++++++++++---- 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 + app/src/main/res/xml/about.xml | 5 ++++ 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index 181fcba06..166161c19 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -11,11 +11,9 @@ import io.legado.app.R import io.legado.app.constant.appInfo import io.legado.app.help.AppConfig import io.legado.app.lib.dialogs.alert +import io.legado.app.lib.dialogs.selector import io.legado.app.ui.widget.dialog.TextDialog -import io.legado.app.utils.openUrl -import io.legado.app.utils.sendMail -import io.legado.app.utils.sendToClip -import io.legado.app.utils.toastOnUi +import io.legado.app.utils.* class AboutFragment : PreferenceFragmentCompat() { @@ -64,6 +62,7 @@ class AboutFragment : PreferenceFragmentCompat() { "disclaimer" -> requireContext().openUrl(disclaimerUrl) "qq" -> showQqGroups() "gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh)) + "crashLog" -> showCrashLogs() "tg" -> openUrl(R.string.tg_url) "discord" -> openUrl(R.string.discord_url) } @@ -111,4 +110,20 @@ class AboutFragment : PreferenceFragmentCompat() { return false } + private fun showCrashLogs() { + context?.externalCacheDir?.let { exCacheDir -> + val crashDir = FileUtils.getFile(exCacheDir, "crash") + val crashLogs = crashDir.listFiles() + val crashLogNames = arrayListOf() + crashLogs?.forEach { + crashLogNames.add(it.name) + } + context?.selector(R.string.crash_log, crashLogNames) { _, select -> + crashLogs?.getOrNull(select)?.let { logFile -> + TextDialog.show(childFragmentManager, logFile.readText()) + } + } + } + } + } \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 5f65064c7..2ec010260 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -806,5 +806,6 @@ 导出到WebDav 反转内容 调试 + 崩溃日志 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 4a7178732..75121734a 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -810,5 +810,6 @@ 匯出到WebDav 反转内容 调试 + 崩溃日志 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index abca7df50..bc57ca217 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -810,5 +810,6 @@ 导出到WebDav 反转内容 调试 + 崩溃日志 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3a8776561..9d11c1a87 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -813,5 +813,6 @@ 导出到WebDav 反转内容 调试 + 崩溃日志 diff --git a/app/src/main/res/xml/about.xml b/app/src/main/res/xml/about.xml index 1ca5fd798..15a6c1523 100644 --- a/app/src/main/res/xml/about.xml +++ b/app/src/main/res/xml/about.xml @@ -88,6 +88,11 @@ app:iconSpaceReserved="false" app:layout="@layout/view_preference_category"> + +