Merge branch 'hotfix/v5.34.5-1035/forum_article_ask_list_crash' into 'release'

fix: 修复论坛详情页闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/378960/?project=22

See merge request halo/android/assistant-android!1617
This commit is contained in:
叶子维
2024-04-12 09:52:06 +08:00

View File

@ -134,9 +134,11 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadRefresh() {
super.onLoadRefresh()
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
// Fixhttps://sentry.shanqu.cc/organizations/lightgame/issues/288994/?project=22&query=LazyListFragment&statsPeriod=14d
// Fragment在内存泄露的情况下调用requireView()会触发崩溃这里替换为getView()方法
// TODO 解决Fragment内存泄露的问题
@ -145,9 +147,11 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadDone() {
super.onLoadDone()
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
view?.setBackgroundColor(Color.TRANSPARENT)
mBaseHandler.postDelayed(Runnable {
tryCatchInRelease {
@ -159,25 +163,31 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadError() {
super.onLoadError()
mBinding.nestedScrollNoConnection.root.visibility = View.VISIBLE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.VISIBLE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun onLoadEmpty() {
super.onLoadEmpty()
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.VISIBLE
mBinding.nestedScrollDataException.root.visibility = View.GONE
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.VISIBLE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun loadNotFound() {
super.loadNotFound()
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.VISIBLE
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.VISIBLE
}
}
override fun hideRefreshingLayout() {