mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-01 08:45:16 +08:00
Revert some changes and Refactor code style again
This commit is contained in:
@@ -62,8 +62,7 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
||||
private var stackTrace = ""
|
||||
|
||||
override fun onCreate() {
|
||||
if (intent.parseAppErrorsInfo().not()) return
|
||||
|
||||
if (initUi(intent).not()) return
|
||||
binding.titleBackIcon.setOnClickListener { onBackPressed() }
|
||||
binding.disableAutoWrapErrorStackTraceSwitch.bind(ConfigData.DISABLE_AUTO_WRAP_ERROR_STACK_TRACE) {
|
||||
onInitialize {
|
||||
@@ -82,12 +81,10 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
||||
/**
|
||||
* 从 [Intent] 中解析 [AppErrorsInfoBean] 并加载至界面
|
||||
*
|
||||
* @receiver [Intent] 待解析的 [Intent] 实例
|
||||
*
|
||||
* @return [Boolean] 是否解析成功:true为成功;false为失败,可能是 [Intent] 为空或者 [AppErrorsInfoBean] 为空
|
||||
* @return [Boolean] 是否解析成功:true 为成功;false 为失败,可能是 [Intent] 为空或者 [AppErrorsInfoBean] 为空
|
||||
*/
|
||||
private fun Intent?.parseAppErrorsInfo(): Boolean {
|
||||
val appErrorsInfo = runCatching { this?.getSerializableExtraCompat<AppErrorsInfoBean>(EXTRA_APP_ERRORS_INFO) }.getOrNull()
|
||||
private fun initUi(intent: Intent?): Boolean {
|
||||
val appErrorsInfo = runCatching { intent?.getSerializableExtraCompat<AppErrorsInfoBean>(EXTRA_APP_ERRORS_INFO) }.getOrNull()
|
||||
if (appErrorsInfo == null) {
|
||||
toastAndFinish(name = "AppErrorsInfo")
|
||||
return false
|
||||
@@ -179,9 +176,9 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
||||
intent?.removeExtra(EXTRA_APP_ERRORS_INFO)
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
if (intent.parseAppErrorsInfo()) binding.appPanelScrollView.scrollTo(0, 0)
|
||||
if (initUi(intent)) binding.appPanelScrollView.scrollTo(0, 0)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user