优化
This commit is contained in:
@@ -22,7 +22,6 @@ import com.sw.inbound.model.response.SearchGoodsInfo
|
||||
import com.sw.inbound.objbox.Food
|
||||
import com.sw.inbound.objbox.FoodCollectionBean
|
||||
import com.sw.inbound.objbox.FoodModule
|
||||
import com.sw.inbound.objbox.Food_
|
||||
import com.sw.inbound.objbox.ObjectBox
|
||||
import com.sw.inbound.utils.BitmapCropper
|
||||
import com.sw.inbound.utils.BitmapSaver
|
||||
@@ -153,25 +152,25 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
binding.btnTakePhoto.clickWithDebounce {
|
||||
takePhoto()
|
||||
}
|
||||
binding.btnAddDefault.clickWithDebounce {
|
||||
Thread{
|
||||
FoodModule.initDefFoodData(this) {
|
||||
runOnUiThread {
|
||||
toast("添加完成")
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
binding.btnRemoveDefault.clickWithDebounce {
|
||||
initBox()
|
||||
val list = box?.all?.filter { it.foodIdx == FoodModule.DEFAULT_FOOD_INDEX }
|
||||
if (list.isNullOrEmpty()) {
|
||||
toast("不存在默认数据")
|
||||
return@clickWithDebounce
|
||||
}
|
||||
box?.removeByIds(list.map { it.id })
|
||||
toast("移除完成")
|
||||
}
|
||||
// binding.btnAddDefault.clickWithDebounce {
|
||||
// Thread{
|
||||
// FoodModule.initDefFoodData(this) {
|
||||
// runOnUiThread {
|
||||
// toast("添加完成")
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
// }
|
||||
// binding.btnRemoveDefault.clickWithDebounce {
|
||||
// initBox()
|
||||
// val list = box?.all?.filter { it.foodIdx == FoodModule.DEFAULT_FOOD_INDEX }
|
||||
// if (list.isNullOrEmpty()) {
|
||||
// toast("不存在默认数据")
|
||||
// return@clickWithDebounce
|
||||
// }
|
||||
// box?.removeByIds(list.map { it.id })
|
||||
// toast("移除完成")
|
||||
// }
|
||||
binding.btnClearData.setOnClickListener { clearData() }
|
||||
binding.rvSearch.let {
|
||||
it.layoutManager = GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false)
|
||||
@@ -188,31 +187,31 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
searchGoods()
|
||||
}
|
||||
}
|
||||
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||
if (checkedId == R.id.rbCollected) {
|
||||
binding.llSearchInput.gone()
|
||||
binding.refreshLayout.let {
|
||||
it.setEnableRefresh(false)
|
||||
it.setEnableLoadMore(false)
|
||||
}
|
||||
getCollectedGoods()
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
if (checkedId == R.id.rbSearch) {
|
||||
binding.llSearchInput.visible()
|
||||
pageNo = 1
|
||||
clickIndex = -1
|
||||
searchGoodsList.clear()
|
||||
searchAdapter.notifyDataSetChanged()
|
||||
binding.refreshLayout.let {
|
||||
it.setEnableRefresh(true)
|
||||
it.setEnableLoadMore(false)
|
||||
}
|
||||
loadEmptyView()
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
}
|
||||
binding.radioGroup.check(R.id.rbCollected)
|
||||
// binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||
// if (checkedId == R.id.rbCollected) {
|
||||
// binding.llSearchInput.gone()
|
||||
// binding.refreshLayout.let {
|
||||
// it.setEnableRefresh(false)
|
||||
// it.setEnableLoadMore(false)
|
||||
// }
|
||||
// getCollectedGoods()
|
||||
// return@setOnCheckedChangeListener
|
||||
// }
|
||||
// if (checkedId == R.id.rbSearch) {
|
||||
// binding.llSearchInput.visible()
|
||||
// pageNo = 1
|
||||
// clickIndex = -1
|
||||
// searchGoodsList.clear()
|
||||
// searchAdapter.notifyDataSetChanged()
|
||||
// binding.refreshLayout.let {
|
||||
// it.setEnableRefresh(true)
|
||||
// it.setEnableLoadMore(false)
|
||||
// }
|
||||
// loadEmptyView()
|
||||
// return@setOnCheckedChangeListener
|
||||
// }
|
||||
// }
|
||||
// binding.radioGroup.check(R.id.rbCollected)
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
|
||||
Reference in New Issue
Block a user