mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-04 02:05: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 = ""
|
private var stackTrace = ""
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
if (intent.parseAppErrorsInfo().not()) return
|
if (initUi(intent).not()) return
|
||||||
|
|
||||||
binding.titleBackIcon.setOnClickListener { onBackPressed() }
|
binding.titleBackIcon.setOnClickListener { onBackPressed() }
|
||||||
binding.disableAutoWrapErrorStackTraceSwitch.bind(ConfigData.DISABLE_AUTO_WRAP_ERROR_STACK_TRACE) {
|
binding.disableAutoWrapErrorStackTraceSwitch.bind(ConfigData.DISABLE_AUTO_WRAP_ERROR_STACK_TRACE) {
|
||||||
onInitialize {
|
onInitialize {
|
||||||
@@ -82,12 +81,10 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
|||||||
/**
|
/**
|
||||||
* 从 [Intent] 中解析 [AppErrorsInfoBean] 并加载至界面
|
* 从 [Intent] 中解析 [AppErrorsInfoBean] 并加载至界面
|
||||||
*
|
*
|
||||||
* @receiver [Intent] 待解析的 [Intent] 实例
|
* @return [Boolean] 是否解析成功:true 为成功;false 为失败,可能是 [Intent] 为空或者 [AppErrorsInfoBean] 为空
|
||||||
*
|
|
||||||
* @return [Boolean] 是否解析成功:true为成功;false为失败,可能是 [Intent] 为空或者 [AppErrorsInfoBean] 为空
|
|
||||||
*/
|
*/
|
||||||
private fun Intent?.parseAppErrorsInfo(): Boolean {
|
private fun initUi(intent: Intent?): Boolean {
|
||||||
val appErrorsInfo = runCatching { this?.getSerializableExtraCompat<AppErrorsInfoBean>(EXTRA_APP_ERRORS_INFO) }.getOrNull()
|
val appErrorsInfo = runCatching { intent?.getSerializableExtraCompat<AppErrorsInfoBean>(EXTRA_APP_ERRORS_INFO) }.getOrNull()
|
||||||
if (appErrorsInfo == null) {
|
if (appErrorsInfo == null) {
|
||||||
toastAndFinish(name = "AppErrorsInfo")
|
toastAndFinish(name = "AppErrorsInfo")
|
||||||
return false
|
return false
|
||||||
@@ -179,9 +176,9 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
|||||||
intent?.removeExtra(EXTRA_APP_ERRORS_INFO)
|
intent?.removeExtra(EXTRA_APP_ERRORS_INFO)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(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