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"> + +