Commit ca5d4bb3 authored by chengkun's avatar chengkun

订单列表下拉刷新

parent ba2022cd
......@@ -3,6 +3,9 @@ package com.yidian.shenghuoquan.border.ui
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import androidx.activity.viewModels
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener
import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.extensions.initTitleBar
import com.yidian.bcommon.mvvm.BaseMvvmActivity
......@@ -16,7 +19,7 @@ import com.yidian.xpage.XPageViewProtocol
import timber.log.Timber
class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, OrderListViewModel>() ,XPageViewProtocol{
class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, OrderListViewModel>() ,XPageViewProtocol, OnRefreshListener{
override val layoutId: Int = R.layout.border_activity_order_list
......@@ -30,7 +33,7 @@ class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, Order
binding.orderListToolbar.setNavigationIcon(R.drawable.icon_arrow_white)
initRecycleView()
initClickEvent()
vm.requestUserOrder(HashMap<String, String?>())
}
private fun initRecycleView() {
......@@ -44,6 +47,9 @@ class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, Order
}
private fun initClickEvent() {
binding.smartRefresh.setEnableLoadMore(false)
binding.smartRefresh.setOnRefreshListener(this)
binding.smartRefresh.autoRefresh()
binding.tvRefunded.setOnClickListener {
binding.tvRefunded.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD))
val dra: Drawable? = getDrawable(R.drawable.icon_react_under_text)
......@@ -73,4 +79,10 @@ class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, Order
override fun getXPageName(): String {
return XRouterPathConstants.ORDER_LIST_ACTIVITY
}
override fun onRefresh(refreshLayout: RefreshLayout) {
vm.requestUserOrder(HashMap<String, String?>())
binding.smartRefresh.finishRefresh()
}
}
......@@ -62,15 +62,22 @@
android:layout_gravity="center_vertical">
</TextView>
</LinearLayout>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh"
android:layout_width="@dimen/dp343"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.scwang.smart.refresh.header.ClassicsHeader>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcv_order_list"
android:layout_width="343dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
>
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager">
</androidx.recyclerview.widget.RecyclerView>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
</layout>
\ No newline at end of file
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