Commit 75ddb555 authored by jyx's avatar jyx

添加下拉刷新

parent 914ebf42
......@@ -17,6 +17,7 @@ import com.duben.speedplaylet.ui.adapter.VipEnjoyAdapter
import com.duben.speedplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.fragment_vip_enjoy.*
/**
......@@ -24,7 +25,8 @@ import kotlinx.android.synthetic.main.fragment_vip_enjoy.*
* @date 2023/12/5
* @desc VIP尊享页面
*/
class VipEnjoyFragment : LazyLoadBaseFragment(), OnLoadMoreListener, VipEnjoyView {
class VipEnjoyFragment : LazyLoadBaseFragment(), OnLoadMoreListener, VipEnjoyView,
OnRefreshListener {
companion object {
fun newInstance(): Fragment {
......@@ -50,7 +52,7 @@ class VipEnjoyFragment : LazyLoadBaseFragment(), OnLoadMoreListener, VipEnjoyVie
override fun onResume() {
super.onResume()
onRefresh()
myRefresh()
}
override fun onDetach() {
......@@ -80,11 +82,12 @@ class VipEnjoyFragment : LazyLoadBaseFragment(), OnLoadMoreListener, VipEnjoyVie
}
private fun initListener() {
srl_enjoy.setEnableRefresh(false)
srl_enjoy.setEnableRefresh(true)
srl_enjoy.setOnLoadMoreListener(this)
srl_enjoy.setOnRefreshListener(this)
}
private fun onRefresh() {
private fun myRefresh() {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
page = 1
srl_enjoy.resetNoMoreData()
......@@ -92,6 +95,10 @@ class VipEnjoyFragment : LazyLoadBaseFragment(), OnLoadMoreListener, VipEnjoyVie
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
myRefresh()
}
override fun onLoadMore(refreshLayout: RefreshLayout) {
page = ++page
vipEnjoyPresenter.getVedio4List(page, pageSize)
......
......@@ -26,6 +26,10 @@
app:srlAccentColor="@color/black"
app:srlPrimaryColor="#f0f2f5">
<com.scwang.smartrefresh.header.MaterialHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment