入库功能增加相机预览及拍照
This commit is contained in:
@@ -67,11 +67,6 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
}
|
||||
private val collectionAdapter: FoodCollectionAdapter by lazy {
|
||||
FoodCollectionAdapter(collectList).apply {
|
||||
// setOnItemClickListener { _, _, position ->
|
||||
// if (collectList[position].isShowCamera) {
|
||||
// takePhoto()
|
||||
// }
|
||||
// }
|
||||
addOnItemChildClickListener(R.id.ivDelete) { _, _, position ->
|
||||
collectList[position].let {
|
||||
it.bitmap = null
|
||||
@@ -79,13 +74,6 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
it.isShowCamera = true
|
||||
}
|
||||
collectionAdapter.notifyItemChanged(position)
|
||||
// if (position == collectList.size - 1) {
|
||||
//
|
||||
// return@addOnItemChildClickListener
|
||||
// }
|
||||
// collectList.removeAt(position)
|
||||
// adapter.notifyItemRemoved(position)
|
||||
// adapter.notifyItemRangeChanged(position, collectList.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,25 +144,6 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
binding.btnCollectedGoods.setOnClickListener {
|
||||
CollectSearchDialog(this@FoodCollectionActivity).show()
|
||||
}
|
||||
// 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)
|
||||
@@ -191,49 +160,10 @@ 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)
|
||||
|
||||
loadEmptyView()
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun getCollectedGoods() {
|
||||
searchGoodsList.clear()
|
||||
initBox()
|
||||
box?.all?.distinctBy { it.name }?.forEach {
|
||||
searchGoodsList.add((SearchGoodsInfo.Record(goodsName = it.name)))
|
||||
}
|
||||
binding.rvSearch.layoutManager = GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false)
|
||||
searchAdapter.notifyDataSetChanged()
|
||||
if (searchGoodsList.isEmpty()) {
|
||||
loadEmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
private var pageNo = 1
|
||||
private var clickIndex = -1
|
||||
|
||||
@@ -313,12 +243,6 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
it.isShowCamera = false
|
||||
}
|
||||
collectionAdapter.notifyItemChanged(index)
|
||||
// if (collectList.size < 6) {
|
||||
// collectList.add(collectList.size - 1, FoodCollectionBean(bitmap = cropBitmap))
|
||||
// } else {
|
||||
// collectList[collectList.size - 1] = FoodCollectionBean(bitmap = cropBitmap)
|
||||
// }
|
||||
// adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user