fix: 修复吧页面“回到顶部”无反应

This commit is contained in:
HuanCheng65 2022-08-26 21:04:41 +08:00
parent f84be23f61
commit 31bb6b9815
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
2 changed files with 5 additions and 3 deletions

View File

@ -496,9 +496,9 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener,
refresh() refresh()
} }
"back_to_top" -> { "back_to_top" -> {
mAdapter?.currentFragment?.apply { mAdapter?.getItem(headerTabView.selectedTabPosition)?.apply {
if (this is ScrollTopable) { if (this is ScrollTopable) {
scrollToTop() this.scrollToTop()
} }
} }
} }

View File

@ -253,8 +253,10 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
} }
override fun scrollToTop() { override fun scrollToTop() {
mRecyclerView.post {
virtualLayoutManager.scrollToPosition(0) virtualLayoutManager.scrollToPosition(0)
} }
}
interface OnRefreshedListener { interface OnRefreshedListener {
fun onSuccess(forumPageBean: ForumPageBean) fun onSuccess(forumPageBean: ForumPageBean)