添加日志查看

pull/883/head
gedoor 4 years ago
parent b6fb37455c
commit 8dab4fe997
  1. 23
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  2. 1
      app/src/main/res/values-zh-rHK/strings.xml
  3. 1
      app/src/main/res/values-zh-rTW/strings.xml
  4. 1
      app/src/main/res/values-zh/strings.xml
  5. 1
      app/src/main/res/values/strings.xml
  6. 5
      app/src/main/res/xml/about.xml

@ -11,11 +11,9 @@ import io.legado.app.R
import io.legado.app.constant.appInfo import io.legado.app.constant.appInfo
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert 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.ui.widget.dialog.TextDialog
import io.legado.app.utils.openUrl import io.legado.app.utils.*
import io.legado.app.utils.sendMail
import io.legado.app.utils.sendToClip
import io.legado.app.utils.toastOnUi
class AboutFragment : PreferenceFragmentCompat() { class AboutFragment : PreferenceFragmentCompat() {
@ -64,6 +62,7 @@ class AboutFragment : PreferenceFragmentCompat() {
"disclaimer" -> requireContext().openUrl(disclaimerUrl) "disclaimer" -> requireContext().openUrl(disclaimerUrl)
"qq" -> showQqGroups() "qq" -> showQqGroups()
"gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh)) "gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh))
"crashLog" -> showCrashLogs()
"tg" -> openUrl(R.string.tg_url) "tg" -> openUrl(R.string.tg_url)
"discord" -> openUrl(R.string.discord_url) "discord" -> openUrl(R.string.discord_url)
} }
@ -111,4 +110,20 @@ class AboutFragment : PreferenceFragmentCompat() {
return false return false
} }
private fun showCrashLogs() {
context?.externalCacheDir?.let { exCacheDir ->
val crashDir = FileUtils.getFile(exCacheDir, "crash")
val crashLogs = crashDir.listFiles()
val crashLogNames = arrayListOf<String>()
crashLogs?.forEach {
crashLogNames.add(it.name)
}
context?.selector(R.string.crash_log, crashLogNames) { _, select ->
crashLogs?.getOrNull(select)?.let { logFile ->
TextDialog.show(childFragmentManager, logFile.readText())
}
}
}
}
} }

@ -806,5 +806,6 @@
<string name="export_to_web_dav">导出到WebDav</string> <string name="export_to_web_dav">导出到WebDav</string>
<string name="reverse_content">反转内容</string> <string name="reverse_content">反转内容</string>
<string name="debug">调试</string> <string name="debug">调试</string>
<string name="crash_log">崩溃日志</string>
</resources> </resources>

@ -810,5 +810,6 @@
<string name="export_to_web_dav">匯出到WebDav</string> <string name="export_to_web_dav">匯出到WebDav</string>
<string name="reverse_content">反转内容</string> <string name="reverse_content">反转内容</string>
<string name="debug">调试</string> <string name="debug">调试</string>
<string name="crash_log">崩溃日志</string>
</resources> </resources>

@ -810,5 +810,6 @@
<string name="export_to_web_dav">导出到WebDav</string> <string name="export_to_web_dav">导出到WebDav</string>
<string name="reverse_content">反转内容</string> <string name="reverse_content">反转内容</string>
<string name="debug">调试</string> <string name="debug">调试</string>
<string name="crash_log">崩溃日志</string>
</resources> </resources>

@ -813,5 +813,6 @@
<string name="export_to_web_dav">导出到WebDav</string> <string name="export_to_web_dav">导出到WebDav</string>
<string name="reverse_content">反转内容</string> <string name="reverse_content">反转内容</string>
<string name="debug">调试</string> <string name="debug">调试</string>
<string name="crash_log">崩溃日志</string>
</resources> </resources>

@ -88,6 +88,11 @@
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
app:layout="@layout/view_preference_category"> app:layout="@layout/view_preference_category">
<io.legado.app.ui.widget.prefs.Preference
android:key="crashLog"
android:title="@string/crash_log"
app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="license" android:key="license"
android:title="@string/license" android:title="@string/license"

Loading…
Cancel
Save