Merge branch 'fix/viewstub_crashes' into 'release'

fix: 修复ViewStub偶发闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/422108/events/?project=22 https://sentry.shanqu.cc/organizations/lightgame/issues/425087/?project=22

See merge request halo/android/assistant-android!2030
This commit is contained in:
叶子维
2025-01-09 15:03:51 +08:00
6 changed files with 19 additions and 14 deletions

View File

@ -239,7 +239,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
viewModel.loadFirst(false)
}
}
binding.reuseNoConnectionStub.inflate()
binding.reuseNoConnectionStub.inflateOrShow()
} else {
noConnectionBinding?.root?.visibility = View.VISIBLE
}
@ -249,7 +249,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
noDataBinding = ReuseNoneDataBinding.bind(inflated)
noDataBinding?.root?.visibility = View.VISIBLE
}
binding.reuseNoDataStub.inflate()
binding.reuseNoDataStub.inflateOrShow()
} else {
noDataBinding?.root?.visibility = View.VISIBLE
}
@ -304,7 +304,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
}
initSearchBar(it)
}
binding.reuseSearchBarStub.inflate()
binding.reuseSearchBarStub.inflateOrShow()
} else {
initSearchBar(it)
}

View File

@ -701,7 +701,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
}
private fun inflateRealView() {
mBinding.stub.inflate()
mBinding.stub.inflateOrShow()
mStubBinding.statusBar.goneIf(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
mStubBinding.darkModeIv.goneIf(!(Config.getNightModeSetting()?.icon ?: false))

View File

@ -160,7 +160,7 @@ abstract class BaseTabWrapperFragment : BaseLazyFragment(), IMultiTab {
showLoading(true)
}
}
noConnectionStub?.inflate()
noConnectionStub?.inflateOrShow()
} else {
noConnectionBinding?.root?.visibility = View.VISIBLE
}
@ -176,7 +176,7 @@ abstract class BaseTabWrapperFragment : BaseLazyFragment(), IMultiTab {
noDataBinding = ReuseNoneDataBinding.bind(inflated)
noDataBinding?.root?.visibility = View.VISIBLE
}
noDataStub?.inflate()
noDataStub?.inflateOrShow()
} else {
noDataBinding?.root?.visibility = View.VISIBLE
}
@ -192,7 +192,7 @@ abstract class BaseTabWrapperFragment : BaseLazyFragment(), IMultiTab {
loadingBinding = ReuseLoadingBinding.bind(inflated)
loadingBinding?.root?.visibility = View.VISIBLE
}
loadingStub?.inflate()
loadingStub?.inflateOrShow()
} else {
loadingBinding?.root?.visibility = View.VISIBLE
}

View File

@ -957,7 +957,7 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
setPullDownPushInternal(pullDownPush, pullDownPushHandler)
}
try {
binding.autoVideoViewStub.inflate()
binding.autoVideoViewStub.inflateOrShow()
} catch (e: Exception) {
SentryHelper.onEvent("VIEW_STUB_INFLATE_ERROR", "digest", e.localizedMessage)
}