Simplify LogActivity onCreate by removing unnecessary block

This commit is contained in:
iovxw 2026-07-21 22:28:33 +08:00
parent 8d2f05713d
commit 60cd2c7cb6
No known key found for this signature in database
GPG Key ID: C84626C2D3D79995

View File

@ -73,27 +73,22 @@ class LogActivity : AppCompatActivity() {
}
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
with(binding) {
setSupportActionBar(toolbar)
this@LogActivity.logView = logView
if (intent.hasExtra(FROM_CRASH)) {
fromCrash = true
supportActionBar!!.setTitle(R.string.crash_logs)
AlertDialog.Builder(this@LogActivity)
.setTitle(R.string.app_crash)
.setMessage(R.string.app_crash_message)
.setPositiveButton(android.R.string.ok, null)
.show()
logView.append("--------- Crash stacktrace")
logView.append(intent.getStringExtra(CRASH_STACK_TRACE) ?: "<empty>")
logView.setLogcat(Logcat(FcitxApplication.getLastPid()))
} else {
supportActionBar!!.apply {
setDisplayHomeAsUpEnabled(true)
setTitle(R.string.real_time_logs)
}
logView.setLogcat(Logcat())
}
this@LogActivity.logView = binding.logView
if (intent.hasExtra(FROM_CRASH)) {
fromCrash = true
supportActionBar!!.setTitle(R.string.crash_logs)
AlertDialog.Builder(this@LogActivity)
.setTitle(R.string.app_crash)
.setMessage(R.string.app_crash_message)
.setPositiveButton(android.R.string.ok, null)
.show()
logView.append("--------- Crash stacktrace")
logView.append(intent.getStringExtra(CRASH_STACK_TRACE) ?: "<empty>")
logView.setLogcat(Logcat(FcitxApplication.getLastPid()))
} else {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setTitle(R.string.real_time_logs)
logView.setLogcat(Logcat())
}
registerLauncher()
}