|
|
@@ -12,7 +12,6 @@ import com.yingyang.livebroadcast.entity.ReservationLiveBean
|
|
|
import com.yingyang.livebroadcast.net.XLivebroadcastServiceFactory
|
|
|
import com.yingyangfly.baselib.dialog.TipDialogFragment
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
-import com.yingyangfly.baselib.ext.show
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.net.BaseObserver
|
|
|
@@ -55,13 +54,15 @@ class LiveBroadcastListActivity :
|
|
|
/**
|
|
|
* 直播adapter
|
|
|
*/
|
|
|
+ private var gridLayoutManager: GridLayoutManager? = null
|
|
|
private val liveBroadcastAdapter by lazy { LiveBroadcastAdapter() }
|
|
|
|
|
|
override fun initViews() {
|
|
|
enableLoadMore(true)
|
|
|
enableRefresh(true)
|
|
|
binding {
|
|
|
- rvLiveBroadcast.layoutManager = GridLayoutManager(mContext, 2)
|
|
|
+ gridLayoutManager = GridLayoutManager(mContext, 2)
|
|
|
+ rvLiveBroadcast.layoutManager = gridLayoutManager
|
|
|
rvLiveBroadcast.adapter = liveBroadcastAdapter
|
|
|
liveBroadcastAdapter.setData(liveBroadcastList)
|
|
|
liveBroadcastAdapter.onLiveBroadcastImageClickListener = { url, method, title, id ->
|
|
|
@@ -86,10 +87,8 @@ class LiveBroadcastListActivity :
|
|
|
|
|
|
}
|
|
|
radioLive.setOnCheckedChangeListener { group, checkedId ->
|
|
|
- binding {
|
|
|
- rvLiveBroadcast.show(true)
|
|
|
- emptyLayout.show(false)
|
|
|
- }
|
|
|
+ liveBroadcastAdapter.clearData()
|
|
|
+ liveBroadcastAdapter.showEmptyView = false
|
|
|
when (checkedId) {
|
|
|
R.id.rdb_appointment -> {
|
|
|
method = "1"
|
|
|
@@ -114,6 +113,8 @@ class LiveBroadcastListActivity :
|
|
|
override fun onRefresh(refreshLayout: RefreshLayout) {
|
|
|
super.onRefresh(refreshLayout)
|
|
|
loadData(true)
|
|
|
+ liveBroadcastAdapter.clearData()
|
|
|
+ liveBroadcastAdapter.showEmptyView = false
|
|
|
}
|
|
|
|
|
|
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
|
|
@@ -155,6 +156,8 @@ class LiveBroadcastListActivity :
|
|
|
|
|
|
override fun initData() {
|
|
|
liveBroadcastAdapter.setType("预约直播")
|
|
|
+ liveBroadcastAdapter.clearData()
|
|
|
+ liveBroadcastAdapter.showEmptyView = false
|
|
|
loadData(true)
|
|
|
}
|
|
|
|
|
|
@@ -183,10 +186,12 @@ class LiveBroadcastListActivity :
|
|
|
finishLoadMoreWithNoMoreData()
|
|
|
}
|
|
|
}
|
|
|
- binding {
|
|
|
- rvLiveBroadcast.show(liveBroadcastList.isNullOrEmpty().not())
|
|
|
- emptyLayout.show(liveBroadcastList.isNullOrEmpty())
|
|
|
+ if (liveBroadcastList.isNullOrEmpty()) {
|
|
|
+ gridLayoutManager?.spanCount = 1
|
|
|
+ } else {
|
|
|
+ gridLayoutManager?.spanCount = 2
|
|
|
}
|
|
|
+ liveBroadcastAdapter.showEmptyView = liveBroadcastList.isNullOrEmpty()
|
|
|
liveBroadcastAdapter.setData(liveBroadcastList)
|
|
|
})
|
|
|
}
|