diff --git a/app/src/main/kotlin/cn/super12138/todo/views/crash/CrashActivity.kt b/app/src/main/kotlin/cn/super12138/todo/views/crash/CrashActivity.kt
index 4fe34b8..1b00ddb 100644
--- a/app/src/main/kotlin/cn/super12138/todo/views/crash/CrashActivity.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/views/crash/CrashActivity.kt
@@ -1,5 +1,6 @@
package cn.super12138.todo.views.crash
+import android.os.Build
import android.os.Bundle
import android.view.ViewGroup
import androidx.activity.enableEdgeToEdge
@@ -8,6 +9,9 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import cn.super12138.todo.databinding.ActivityCrashBinding
import cn.super12138.todo.views.BaseActivity
+import java.text.SimpleDateFormat
+import java.util.Calendar
+import java.util.Locale
class CrashActivity : BaseActivity() {
private lateinit var binding: ActivityCrashBinding
@@ -30,7 +34,36 @@ class CrashActivity : BaseActivity() {
}
val crashLogs = intent.getStringExtra("crash_logs")
- binding.crashLog.text = crashLogs
+
+ val deviceBrand = Build.BRAND
+ val deviceModel = Build.MODEL
+ val sdkLevel = Build.VERSION.SDK_INT
+ val currentDateTime = Calendar.getInstance().time
+ val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
+ val formattedDateTime = formatter.format(currentDateTime)
+
+ val pkgInfo = packageManager.getPackageInfo(packageName, 0)
+ val verName = pkgInfo.versionName
+ val verCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ pkgInfo.longVersionCode.toInt()
+ } else {
+ pkgInfo.versionCode
+ }
+ val mergeVer = "$verName($verCode)"
+
+ val deviceInfo = StringBuilder().apply {
+ append("ToDo version: ").append(mergeVer).append('\n')
+ append("Brand: ").append("").append(deviceBrand).append('\n')
+ append("Model: ").append(deviceModel).append('\n')
+ append("Device SDK: ").append(sdkLevel).append('\n').append('\n')
+ append("Crash time: ").append(formattedDateTime).append('\n').append('\n')
+ append("======beginning of crash======").append('\n')
+ }
+
+ binding.crashLog.text = StringBuilder().apply {
+ append(deviceInfo)
+ append(crashLogs)
+ }
binding.exitApp.setOnClickListener {
this.finishAffinity()
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 26b6c17..e39852a 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -7,7 +7,7 @@
检查更新
应用程序出现错误
- 别担心,下方是错误日志,请全选复制然后把它发送给我,我会尽快解决问题
+ 别担心,下方是错误日志,请全选复制然后反馈到 GitHub Issues,我会尽快解决问题
没有日志传入
退出应用
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c1e0eac..ee485a6 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,7 +7,7 @@
View source on GitHub
Oops! App went wrong
- Don\'t worry, crash logs under there! Please copy them and send to me, I\'ll solve this problem
+ Don\'t worry, below is the error log. Please select all and copy it, and then provide feedback on GitHub Issues. I will resolve the issue as soon as possible.
No crash logs
Exit app