|
@@ -7,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
|
|
+import com.swago.baseswago.constant.UrlConstant
|
|
import com.swago.baseswago.cusview.SwagoRecyclerView
|
|
import com.swago.baseswago.cusview.SwagoRecyclerView
|
|
import com.swago.baseswago.fragment.BaseListFragment
|
|
import com.swago.baseswago.fragment.BaseListFragment
|
|
import com.swago.baseswago.fragment.BaseXFragment
|
|
import com.swago.baseswago.fragment.BaseXFragment
|
|
@@ -34,11 +35,44 @@ class NewFragment : BaseListFragment<FragmentHotBinding, MomentModel>(){
|
|
override val layoutManager: RecyclerView.LayoutManager by lazy {
|
|
override val layoutManager: RecyclerView.LayoutManager by lazy {
|
|
GridLayoutManager(context,2)
|
|
GridLayoutManager(context,2)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private var labelValue = 0
|
|
|
|
+ private var selectedPosition = 0
|
|
|
|
+
|
|
|
|
+
|
|
override val loadData: (page: Int) -> Unit = {
|
|
override val loadData: (page: Int) -> Unit = {
|
|
- homeVm.getHomeList(2, it+1)
|
|
|
|
|
|
+ homeVm.getHomeList(2, it+1,labelValue)
|
|
}
|
|
}
|
|
|
|
|
|
override fun initViewData() {
|
|
override fun initViewData() {
|
|
|
|
+ UrlConstant.getConfigModel()?.let {
|
|
|
|
+ if (!it.language_lables.isNullOrEmpty()){
|
|
|
|
+ context?.let { context ->
|
|
|
|
+ val labelAdapter = LabelAdapter()
|
|
|
|
+ binding.rvLabel.layoutManager = LinearLayoutManager(context,RecyclerView.HORIZONTAL,false)
|
|
|
|
+ binding.rvLabel.adapter = labelAdapter
|
|
|
|
+ it.language_lables?.let { list ->
|
|
|
|
+ list[0].isSelected = true
|
|
|
|
+ labelValue = list[0].id
|
|
|
|
+ selectedPosition = 0
|
|
|
|
+ labelAdapter.setNewData(list)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ labelAdapter.setOnItemClickListener { _, _, position ->
|
|
|
|
+ labelAdapter.data[selectedPosition].isSelected = false
|
|
|
|
+ labelAdapter.data[position].isSelected = true
|
|
|
|
+ labelAdapter.notifyItemChanged(selectedPosition)
|
|
|
|
+ labelAdapter.notifyItemChanged(position)
|
|
|
|
+ selectedPosition = position
|
|
|
|
+ labelValue = labelAdapter.data[position].id
|
|
|
|
+ smartRecyclerView.startRefresh()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
smartRecyclerView.recyclerView?.addItemDecoration(ComGridItemDecoration())
|
|
smartRecyclerView.recyclerView?.addItemDecoration(ComGridItemDecoration())
|
|
adapter.setOnItemClickListener { _, _, position ->
|
|
adapter.setOnItemClickListener { _, _, position ->
|
|
ARouter.getInstance()
|
|
ARouter.getInstance()
|