接口联调

This commit is contained in:
2025-11-28 18:46:41 +08:00
parent 9bcd7c9983
commit 29188c5944
39 changed files with 1882 additions and 1662 deletions
@@ -10,11 +10,11 @@
//import com.sw.dualscreen.R
//import com.sw.dualscreen.databinding.ListItemCollectedDataBinding
//import com.sw.dualscreen.databinding.ListItemFoodCollectionBinding
//import com.sw.dualscreen.objbox.CollectedFoodBean
//import com.sw.dualscreen.objbox.CollectedFoodInfo
//import com.sw.dualscreen.objbox.FoodCollectionBean
//
//class CollectedFoodAdapter (var list: MutableList<CollectedFoodBean>) :
// BaseQuickAdapter<CollectedFoodBean, CollectedFoodAdapter.VH>(list) {
//class CollectedFoodAdapter (var list: MutableList<CollectedFoodInfo>) :
// BaseQuickAdapter<CollectedFoodInfo, CollectedFoodAdapter.VH>(list) {
//
// inner class VH(var binding: ListItemCollectedDataBinding) : QuickViewHolder(binding.root)
//
@@ -24,7 +24,7 @@
// return VH(binding)
// }
//
// override fun onBindViewHolder(holder: VH, position: Int, item: CollectedFoodBean?) {
// override fun onBindViewHolder(holder: VH, position: Int, item: CollectedFoodInfo?) {
// holder.binding.tvFoodName.text = item?.foodName
// holder.binding.divider.run {
// visibility = if (position == list.size - 1) View.GONE else View.VISIBLE
@@ -6,10 +6,10 @@ import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.sw.dualscreen.databinding.ListItemCollectedFoodBinding
import com.sw.dualscreen.objbox.CollectedFoodBean
import com.sw.dualscreen.objbox.CollectedFoodInfo
class CollectedFoodNewAdapter(var list: MutableList<CollectedFoodBean>) :
BaseQuickAdapter<CollectedFoodBean, CollectedFoodNewAdapter.VH>(list) {
class CollectedFoodNewAdapter(var list: MutableList<CollectedFoodInfo>) :
BaseQuickAdapter<CollectedFoodInfo, CollectedFoodNewAdapter.VH>(list) {
inner class VH(var binding: ListItemCollectedFoodBinding) : QuickViewHolder(binding.root)
@@ -19,9 +19,9 @@ class CollectedFoodNewAdapter(var list: MutableList<CollectedFoodBean>) :
return VH(binding)
}
override fun onBindViewHolder(holder: VH, position: Int, item: CollectedFoodBean?) {
override fun onBindViewHolder(holder: VH, position: Int, item: CollectedFoodInfo?) {
holder.binding.tvFoodName.text = item?.foodName
holder.binding.tvCollectedNum.text = "已采集${item?.count}"
holder.binding.tvCollectedNum.text = "已采集${item?.foodCount}"
}
}
@@ -26,7 +26,7 @@ class SearchFoodAdapter(var list: MutableList<FoodInfo>) :
text = item.foodName
} else {
val score = (item.score / 100.0).format2String(2)
text = item.foodName + if (item.score != 0) "-${score}%" else ""
text = item.foodName + (if (item.score != 0) "-${score}%" else "")
}
isChecked = item.isChecked
}