优化
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.Food
|
||||||
import com.sw.inbound.objbox.FoodCollectionBean
|
import com.sw.inbound.objbox.FoodCollectionBean
|
||||||
import com.sw.inbound.objbox.FoodModule
|
import com.sw.inbound.objbox.FoodModule
|
||||||
import com.sw.inbound.objbox.Food_
|
|
||||||
import com.sw.inbound.objbox.ObjectBox
|
import com.sw.inbound.objbox.ObjectBox
|
||||||
import com.sw.inbound.utils.BitmapCropper
|
import com.sw.inbound.utils.BitmapCropper
|
||||||
import com.sw.inbound.utils.BitmapSaver
|
import com.sw.inbound.utils.BitmapSaver
|
||||||
@@ -153,25 +152,25 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
binding.btnTakePhoto.clickWithDebounce {
|
binding.btnTakePhoto.clickWithDebounce {
|
||||||
takePhoto()
|
takePhoto()
|
||||||
}
|
}
|
||||||
binding.btnAddDefault.clickWithDebounce {
|
// binding.btnAddDefault.clickWithDebounce {
|
||||||
Thread{
|
// Thread{
|
||||||
FoodModule.initDefFoodData(this) {
|
// FoodModule.initDefFoodData(this) {
|
||||||
runOnUiThread {
|
// runOnUiThread {
|
||||||
toast("添加完成")
|
// toast("添加完成")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}.start()
|
// }.start()
|
||||||
}
|
// }
|
||||||
binding.btnRemoveDefault.clickWithDebounce {
|
// binding.btnRemoveDefault.clickWithDebounce {
|
||||||
initBox()
|
// initBox()
|
||||||
val list = box?.all?.filter { it.foodIdx == FoodModule.DEFAULT_FOOD_INDEX }
|
// val list = box?.all?.filter { it.foodIdx == FoodModule.DEFAULT_FOOD_INDEX }
|
||||||
if (list.isNullOrEmpty()) {
|
// if (list.isNullOrEmpty()) {
|
||||||
toast("不存在默认数据")
|
// toast("不存在默认数据")
|
||||||
return@clickWithDebounce
|
// return@clickWithDebounce
|
||||||
}
|
// }
|
||||||
box?.removeByIds(list.map { it.id })
|
// box?.removeByIds(list.map { it.id })
|
||||||
toast("移除完成")
|
// toast("移除完成")
|
||||||
}
|
// }
|
||||||
binding.btnClearData.setOnClickListener { clearData() }
|
binding.btnClearData.setOnClickListener { clearData() }
|
||||||
binding.rvSearch.let {
|
binding.rvSearch.let {
|
||||||
it.layoutManager = GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false)
|
it.layoutManager = GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false)
|
||||||
@@ -188,31 +187,31 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
searchGoods()
|
searchGoods()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
|
// binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||||
if (checkedId == R.id.rbCollected) {
|
// if (checkedId == R.id.rbCollected) {
|
||||||
binding.llSearchInput.gone()
|
// binding.llSearchInput.gone()
|
||||||
binding.refreshLayout.let {
|
// binding.refreshLayout.let {
|
||||||
it.setEnableRefresh(false)
|
// it.setEnableRefresh(false)
|
||||||
it.setEnableLoadMore(false)
|
// it.setEnableLoadMore(false)
|
||||||
}
|
// }
|
||||||
getCollectedGoods()
|
// getCollectedGoods()
|
||||||
return@setOnCheckedChangeListener
|
// return@setOnCheckedChangeListener
|
||||||
}
|
// }
|
||||||
if (checkedId == R.id.rbSearch) {
|
// if (checkedId == R.id.rbSearch) {
|
||||||
binding.llSearchInput.visible()
|
// binding.llSearchInput.visible()
|
||||||
pageNo = 1
|
// pageNo = 1
|
||||||
clickIndex = -1
|
// clickIndex = -1
|
||||||
searchGoodsList.clear()
|
// searchGoodsList.clear()
|
||||||
searchAdapter.notifyDataSetChanged()
|
// searchAdapter.notifyDataSetChanged()
|
||||||
binding.refreshLayout.let {
|
// binding.refreshLayout.let {
|
||||||
it.setEnableRefresh(true)
|
// it.setEnableRefresh(true)
|
||||||
it.setEnableLoadMore(false)
|
// it.setEnableLoadMore(false)
|
||||||
}
|
// }
|
||||||
loadEmptyView()
|
// loadEmptyView()
|
||||||
return@setOnCheckedChangeListener
|
// return@setOnCheckedChangeListener
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
binding.radioGroup.check(R.id.rbCollected)
|
// binding.radioGroup.check(R.id.rbCollected)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.sw.inbound.databinding.ActivityGoodsListBinding
|
|||||||
import com.sw.inbound.databinding.LayoutCameraPreviewBinding
|
import com.sw.inbound.databinding.LayoutCameraPreviewBinding
|
||||||
import com.sw.inbound.databinding.ListItemReceiptGoodsBinding
|
import com.sw.inbound.databinding.ListItemReceiptGoodsBinding
|
||||||
import com.sw.inbound.databinding.ListItemSelfProcurementBinding
|
import com.sw.inbound.databinding.ListItemSelfProcurementBinding
|
||||||
|
import com.sw.inbound.dialog.DialogManager
|
||||||
import com.sw.inbound.dialog.DropdownPopup
|
import com.sw.inbound.dialog.DropdownPopup
|
||||||
import com.sw.inbound.dialog.GoodsRecognizeDialog
|
import com.sw.inbound.dialog.GoodsRecognizeDialog
|
||||||
import com.sw.inbound.dialog.GoodsSearchDialog
|
import com.sw.inbound.dialog.GoodsSearchDialog
|
||||||
@@ -60,7 +61,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
public const val IS_NEW_RECEIPT = "isNewReceipt"
|
public const val IS_NEW_RECEIPT = "isNewReceipt"
|
||||||
|
|
||||||
const val PAGE_SIZE = 10
|
const val PAGE_SIZE = 10
|
||||||
private const val DELAY_TIME = 30 * 1000
|
private const val DELAY_TIME = 10 * 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
var isReceiptPage: Boolean = false
|
var isReceiptPage: Boolean = false
|
||||||
@@ -164,7 +165,9 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
//}
|
//}
|
||||||
if (weight < 200) {
|
if (weight < 200) {
|
||||||
if (abs(weight) < 10) {
|
if (abs(weight) < 10) {
|
||||||
if (goodsRecognizeDialog?.isShowing == true) {
|
if (DialogManager.getDialogList().size == 1 &&
|
||||||
|
DialogManager.contains("GoodsRecognizeDialog") &&
|
||||||
|
goodsRecognizeDialog?.isShowing == true) {
|
||||||
goodsRecognizeDialog?.dismiss()
|
goodsRecognizeDialog?.dismiss()
|
||||||
isShowRecognizeDialog = true
|
isShowRecognizeDialog = true
|
||||||
goodsRecognizeDialog = null
|
goodsRecognizeDialog = null
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.sw.inbound.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
|
import com.sw.inbound.databinding.ListItemCollectSearchBinding
|
||||||
|
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||||
|
import com.sw.inbound.utils.ext.dp
|
||||||
|
import com.sw.inbound.utils.ext.setShapeDrawable
|
||||||
|
|
||||||
|
class CollectSearchAdapter(var list: MutableList<SearchGoodsInfo.Record>) :
|
||||||
|
BaseQuickAdapter<SearchGoodsInfo.Record, CollectSearchAdapter.VH>(list) {
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemCollectSearchBinding) : QuickViewHolder(binding.root)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val binding = ListItemCollectSearchBinding.inflate(inflater, parent, false)
|
||||||
|
return VH(binding)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: VH, position: Int, item: SearchGoodsInfo.Record?) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.tvGoodsName.run {
|
||||||
|
text = item!!.goodsName
|
||||||
|
// setTextColor(if (item!!.isSelected) "#FF0032C8".toColorInt() else "#FF666666".toColorInt())
|
||||||
|
setTextColor("#FF666666".toColorInt())
|
||||||
|
}
|
||||||
|
// it.root.run {
|
||||||
|
// if (item!!.isSelected) {
|
||||||
|
// setShapeDrawable(
|
||||||
|
// solidColor = "#FFEAF0FF",
|
||||||
|
// strokeColor = "#FF0033CC",
|
||||||
|
// strokeWidth = 2.dp,
|
||||||
|
// radius = 10.dp
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// setShapeDrawable(
|
||||||
|
// solidColor = "#FFF5F5F5",
|
||||||
|
// radius = 10.dp
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
it.root.run {
|
||||||
|
setShapeDrawable(
|
||||||
|
solidColor = "#FFF5F5F5",
|
||||||
|
radius = 10.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,4 +47,14 @@ abstract class BaseDialog(
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
super.show()
|
||||||
|
DialogManager.addDialog(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dismiss() {
|
||||||
|
super.dismiss()
|
||||||
|
DialogManager.removeDialog(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package com.sw.inbound.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.sw.inbound.R
|
||||||
|
import com.sw.inbound.activity.GoodsListActivity
|
||||||
|
import com.sw.inbound.adapter.CollectSearchAdapter
|
||||||
|
import com.sw.inbound.databinding.DialogCollectSearchBinding
|
||||||
|
import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
||||||
|
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||||
|
import com.sw.inbound.objbox.Food
|
||||||
|
import com.sw.inbound.objbox.ObjectBox
|
||||||
|
import com.sw.inbound.utils.ext.addOnActionSearchListener
|
||||||
|
import com.sw.inbound.utils.ext.hideKeyboard
|
||||||
|
import com.sw.inbound.utils.ext.toast
|
||||||
|
import io.objectbox.Box
|
||||||
|
import io.objectbox.kotlin.boxFor
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
class CollectSearchDialog(
|
||||||
|
context: Context
|
||||||
|
) : BaseDialog(context) {
|
||||||
|
|
||||||
|
private lateinit var inflater: LayoutInflater
|
||||||
|
private var emptyBinding: LayoutEmptySearchBinding? = null
|
||||||
|
private lateinit var binding: DialogCollectSearchBinding
|
||||||
|
override fun getRootView(): View {
|
||||||
|
inflater = LayoutInflater.from(context)
|
||||||
|
binding = DialogCollectSearchBinding.inflate(inflater)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
private var activity: GoodsListActivity? = null
|
||||||
|
override fun initView() {
|
||||||
|
activity = getReceiptActivity()
|
||||||
|
binding.ivClose.setOnClickListener { dismiss() }
|
||||||
|
binding.ivGoodsSearch.setOnClickListener { searchGoods() }
|
||||||
|
binding.etInputGoods.let { v ->
|
||||||
|
v.addOnActionSearchListener {
|
||||||
|
searchGoods()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.btnConfirm.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
binding.rvSearch.let {
|
||||||
|
it.layoutManager = GridLayoutManager(context, 2, LinearLayoutManager.VERTICAL, false)
|
||||||
|
it.adapter = searchAdapter
|
||||||
|
}
|
||||||
|
binding.refreshLayout.let {
|
||||||
|
it.setEnableRefresh(true)
|
||||||
|
it.setEnableLoadMore(false)
|
||||||
|
it.setOnRefreshListener {
|
||||||
|
pageNo = 1
|
||||||
|
searchGoods()
|
||||||
|
}
|
||||||
|
it.setOnLoadMoreListener {
|
||||||
|
searchGoods()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getCollectGoods()
|
||||||
|
}
|
||||||
|
|
||||||
|
private var pageNo = 1
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val PAGE_SIZE = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun searchGoods() {
|
||||||
|
val searchName = binding.etInputGoods.text.toString().trim()
|
||||||
|
if (searchName.isBlank()) {
|
||||||
|
activity?.toast("请输入物品名称")
|
||||||
|
finishRefresh()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
activity?.searchGoods(
|
||||||
|
searchName = searchName,
|
||||||
|
pageNo = pageNo,
|
||||||
|
pageSize = PAGE_SIZE
|
||||||
|
) { records ->
|
||||||
|
finishRefresh()
|
||||||
|
binding.etInputGoods.hideKeyboard()
|
||||||
|
if (pageNo == 1) {
|
||||||
|
list.clear()
|
||||||
|
}
|
||||||
|
list.addAll(records)
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
loadEmptyView()
|
||||||
|
return@searchGoods
|
||||||
|
}
|
||||||
|
val enableLoadMore = records.size >= PAGE_SIZE
|
||||||
|
binding.refreshLayout.setEnableLoadMore(enableLoadMore)
|
||||||
|
if (enableLoadMore) {
|
||||||
|
pageNo++
|
||||||
|
}
|
||||||
|
binding.rvSearch.layoutManager =
|
||||||
|
GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false)
|
||||||
|
searchAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadEmptyView() {
|
||||||
|
binding.rvSearch.layoutManager =
|
||||||
|
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||||
|
if (emptyBinding == null) {
|
||||||
|
emptyBinding = LayoutEmptySearchBinding.inflate(inflater, binding.rvSearch, false)
|
||||||
|
}
|
||||||
|
emptyBinding?.root?.let { layout ->
|
||||||
|
layout.setOnClickListener { layout.hideKeyboard() }
|
||||||
|
searchAdapter.stateView = layout
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var clickIndex = -1
|
||||||
|
|
||||||
|
private val list: MutableList<SearchGoodsInfo.Record> = mutableListOf()
|
||||||
|
private val searchAdapter by lazy {
|
||||||
|
CollectSearchAdapter(list).apply {
|
||||||
|
isStateViewEnable = true
|
||||||
|
setOnItemClickListener { _, _, position ->
|
||||||
|
this@CollectSearchDialog.clickIndex = position
|
||||||
|
if (list[position].isSelected) {
|
||||||
|
return@setOnItemClickListener
|
||||||
|
}
|
||||||
|
list.forEach { item ->
|
||||||
|
item.isSelected = false
|
||||||
|
}
|
||||||
|
list[position].isSelected = true
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
addOnItemChildClickListener(R.id.ivDelete) { _, _, position ->
|
||||||
|
deleteGoods(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun deleteGoods(position:Int) {
|
||||||
|
WarnDialog(context = context, content = "请确认是否删除该物品?", confirmBlock = {
|
||||||
|
Thread{
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
Loading.show(context)
|
||||||
|
}
|
||||||
|
val name = list[position].goodsName
|
||||||
|
val filterIdList = box?.all?.filter { it.name == name }?.map { it.id }
|
||||||
|
box?.removeByIds(filterIdList)
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
Loading.dismiss()
|
||||||
|
list.removeAt(position)
|
||||||
|
searchAdapter.notifyDataSetChanged()
|
||||||
|
activity?.toast("删除成功")
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
}).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun finishRefresh() {
|
||||||
|
binding.refreshLayout.let {
|
||||||
|
if (pageNo == 1) {
|
||||||
|
it.finishRefresh(500)
|
||||||
|
} else {
|
||||||
|
it.finishLoadMore(500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var box: Box<Food>? = null
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun getCollectGoods() {
|
||||||
|
if (box == null) {
|
||||||
|
box = ObjectBox.boxStore.boxFor(Food::class)
|
||||||
|
}
|
||||||
|
box?.all?.distinctBy { it.name }?.forEach {
|
||||||
|
list.add((SearchGoodsInfo.Record(goodsName = it.name)))
|
||||||
|
}
|
||||||
|
binding.rvSearch.layoutManager = GridLayoutManager(activity, 2, LinearLayoutManager.VERTICAL, false)
|
||||||
|
searchAdapter.notifyDataSetChanged()
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
loadEmptyView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.sw.inbound.dialog
|
||||||
|
|
||||||
|
object DialogManager {
|
||||||
|
|
||||||
|
private var dialogList:MutableList<BaseDialog> = mutableListOf()
|
||||||
|
|
||||||
|
fun addDialog(dialog: BaseDialog) {
|
||||||
|
if (dialogList.contains(dialog).not()) {
|
||||||
|
val className = dialog.javaClass.simpleName
|
||||||
|
val item = dialogList.firstOrNull { it.javaClass.simpleName == className }
|
||||||
|
item?.dismiss()
|
||||||
|
dialogList.add(dialog)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeDialog(dialog: BaseDialog) {
|
||||||
|
dialogList.remove(dialog)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDialogList():MutableList<BaseDialog> {
|
||||||
|
return dialogList
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dismissAll() {
|
||||||
|
dialogList.forEach {
|
||||||
|
it.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dismissAllExcept(dialog: BaseDialog) {
|
||||||
|
dialogList.forEach {
|
||||||
|
if (it != dialog) {
|
||||||
|
it.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun contains(vararg className: String):Boolean {
|
||||||
|
val item = dialogList.firstOrNull { className.contains(it.javaClass.simpleName) }
|
||||||
|
return item != null
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -187,8 +187,12 @@ class GoodsStoreDialog(
|
|||||||
}
|
}
|
||||||
val id = unitTag.toString()
|
val id = unitTag.toString()
|
||||||
val count = getUnitCount(id)
|
val count = getUnitCount(id)
|
||||||
|
if (count.isBlank() || "0" == count) {
|
||||||
|
binding.etProcurementCount.setText("")
|
||||||
|
return@readWeightInfo
|
||||||
|
}
|
||||||
val currentCount = binding.etProcurementCount.text.toString().trim()
|
val currentCount = binding.etProcurementCount.text.toString().trim()
|
||||||
if (currentCount == count || count.isBlank() || "0" == count) {
|
if (currentCount == count) {
|
||||||
return@readWeightInfo
|
return@readWeightInfo
|
||||||
}
|
}
|
||||||
binding.etProcurementCount.let {
|
binding.etProcurementCount.let {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ object FoodModule {
|
|||||||
nameScoreList.add(IdNameScore(id = it.id, name = box.get(it.id).name?:"", score = it.score))
|
nameScoreList.add(IdNameScore(id = it.id, name = box.get(it.id).name?:"", score = it.score))
|
||||||
}
|
}
|
||||||
Timber.tag("FoodModule").d("queryFood数据:${nameScoreList.toJsonString()}")
|
Timber.tag("FoodModule").d("queryFood数据:${nameScoreList.toJsonString()}")
|
||||||
idScoreList.filter { it.score < 0.01 }.forEach {
|
idScoreList.filter { it.score < 0.10 }.forEach {
|
||||||
val food = box.get(it.id)
|
val food = box.get(it.id)
|
||||||
//FoodQueryResult(id = it.id, name = food.name, foodIdx = food.foodIdx, score = it.score)
|
//FoodQueryResult(id = it.id, name = food.name, foodIdx = food.foodIdx, score = it.score)
|
||||||
food.name?.let { key ->
|
food.name?.let { key ->
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ object SensorScaleUtils {
|
|||||||
// SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
// SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
||||||
// else -> "未知"
|
// else -> "未知"
|
||||||
//}
|
//}
|
||||||
if (state != SensorScale.STATE_STABLE) {
|
// if (state != SensorScale.STATE_STABLE) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
weightCallback?.invoke((value * 1000).toInt())
|
weightCallback?.invoke((value * 1000).toInt())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,29 +50,29 @@
|
|||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/btnAddDefault"
|
<!-- android:id="@+id/btnAddDefault"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="60dp"
|
<!-- android:layout_height="60dp"-->
|
||||||
android:background="@drawable/bg_white_stroke_blue_ripple"
|
<!-- android:background="@drawable/bg_white_stroke_blue_ripple"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:paddingHorizontal="10dp"
|
<!-- android:paddingHorizontal="10dp"-->
|
||||||
android:text="加载默认数据"
|
<!-- android:text="加载默认数据"-->
|
||||||
android:textColor="#FF0032C8"
|
<!-- android:textColor="#FF0032C8"-->
|
||||||
android:textSize="18sp" />
|
<!-- android:textSize="18sp" />-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/btnRemoveDefault"
|
<!-- android:id="@+id/btnRemoveDefault"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="60dp"
|
<!-- android:layout_height="60dp"-->
|
||||||
android:layout_marginStart="20dp"
|
<!-- android:layout_marginStart="20dp"-->
|
||||||
android:layout_marginEnd="20dp"
|
<!-- android:layout_marginEnd="20dp"-->
|
||||||
android:background="@drawable/bg_white_stroke_blue_ripple"
|
<!-- android:background="@drawable/bg_white_stroke_blue_ripple"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:paddingHorizontal="10dp"
|
<!-- android:paddingHorizontal="10dp"-->
|
||||||
android:text="移除默认数据"
|
<!-- android:text="移除默认数据"-->
|
||||||
android:textColor="#FF0032C8"
|
<!-- android:textColor="#FF0032C8"-->
|
||||||
android:textSize="18sp" />
|
<!-- android:textSize="18sp" />-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
@@ -165,68 +165,68 @@
|
|||||||
tools:listitem="@layout/list_item_food_collection" />
|
tools:listitem="@layout/list_item_food_collection" />
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <LinearLayout-->
|
||||||
android:id="@+id/layoutTab"
|
<!-- android:id="@+id/layoutTab"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="80dp"
|
<!-- android:layout_height="80dp"-->
|
||||||
android:layout_marginHorizontal="20dp"
|
<!-- android:layout_marginHorizontal="20dp"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:orientation="horizontal"
|
<!-- android:orientation="horizontal"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
<!-- app:layout_constraintStart_toEndOf="@id/rvFoodCollection"-->
|
||||||
app:layout_constraintTop_toTopOf="@id/flPreview">
|
<!-- app:layout_constraintTop_toTopOf="@id/flPreview">-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:text="物品筛选:"
|
<!-- android:text="物品筛选:"-->
|
||||||
android:textColor="#ff333333"
|
<!-- android:textColor="#ff333333"-->
|
||||||
android:textSize="24sp"
|
<!-- android:textSize="24sp"-->
|
||||||
android:textStyle="bold" />
|
<!-- android:textStyle="bold" />-->
|
||||||
|
|
||||||
<RadioGroup
|
<!-- <RadioGroup-->
|
||||||
android:id="@+id/radioGroup"
|
<!-- android:id="@+id/radioGroup"-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="80dp"
|
<!-- android:layout_height="80dp"-->
|
||||||
android:layout_marginHorizontal="20dp"
|
<!-- android:layout_marginHorizontal="20dp"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:orientation="horizontal"
|
<!-- android:orientation="horizontal"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
<!-- app:layout_constraintStart_toEndOf="@id/rvFoodCollection"-->
|
||||||
app:layout_constraintTop_toTopOf="@id/flPreview">
|
<!-- app:layout_constraintTop_toTopOf="@id/flPreview">-->
|
||||||
|
|
||||||
<RadioButton
|
<!-- <RadioButton-->
|
||||||
android:id="@+id/rbCollected"
|
<!-- android:id="@+id/rbCollected"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="match_parent"
|
<!-- android:layout_height="match_parent"-->
|
||||||
android:layout_weight="1"
|
<!-- android:layout_weight="1"-->
|
||||||
android:button="@null"
|
<!-- android:button="@null"-->
|
||||||
android:drawableStart="@drawable/radio_check"
|
<!-- android:drawableStart="@drawable/radio_check"-->
|
||||||
android:drawablePadding="20dp"
|
<!-- android:drawablePadding="20dp"-->
|
||||||
android:paddingStart="20dp"
|
<!-- android:paddingStart="20dp"-->
|
||||||
android:paddingEnd="0dp"
|
<!-- android:paddingEnd="0dp"-->
|
||||||
android:text="已采集物品"
|
<!-- android:text="已采集物品"-->
|
||||||
android:textColor="@color/radio_filter"
|
<!-- android:textColor="@color/radio_filter"-->
|
||||||
android:textSize="24sp" />
|
<!-- android:textSize="24sp" />-->
|
||||||
|
|
||||||
<RadioButton
|
<!-- <RadioButton-->
|
||||||
android:id="@+id/rbSearch"
|
<!-- android:id="@+id/rbSearch"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="match_parent"
|
<!-- android:layout_height="match_parent"-->
|
||||||
android:layout_weight="1"
|
<!-- android:layout_weight="1"-->
|
||||||
android:button="@null"
|
<!-- android:button="@null"-->
|
||||||
android:drawableStart="@drawable/radio_check"
|
<!-- android:drawableStart="@drawable/radio_check"-->
|
||||||
android:drawablePadding="20dp"
|
<!-- android:drawablePadding="20dp"-->
|
||||||
android:paddingStart="20dp"
|
<!-- android:paddingStart="20dp"-->
|
||||||
android:paddingEnd="0dp"
|
<!-- android:paddingEnd="0dp"-->
|
||||||
android:text="搜索物品"
|
<!-- android:text="搜索物品"-->
|
||||||
android:textColor="@color/radio_filter"
|
<!-- android:textColor="@color/radio_filter"-->
|
||||||
android:textSize="24sp" />
|
<!-- android:textSize="24sp" />-->
|
||||||
|
|
||||||
</RadioGroup>
|
<!-- </RadioGroup>-->
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- </LinearLayout>-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/llSearchInput"
|
android:id="@+id/llSearchInput"
|
||||||
@@ -236,10 +236,10 @@
|
|||||||
android:background="@drawable/bg_gray"
|
android:background="@drawable/bg_gray"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
||||||
app:layout_constraintTop_toBottomOf="@id/layoutTab">
|
app:layout_constraintTop_toTopOf="@id/flPreview">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etGoodsInput"
|
android:id="@+id/etGoodsInput"
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="1500dp"
|
||||||
|
android:layout_height="900dp"
|
||||||
|
android:background="@drawable/bg_white_radius12"
|
||||||
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivClose"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@mipmap/ic_close"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvDialogTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="已采集物品检索"
|
||||||
|
android:textColor="#ff141428"
|
||||||
|
android:textSize="36sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/flSearchBlock"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/flSearchBlock"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginHorizontal="150dp"
|
||||||
|
android:layout_marginTop="180dp"
|
||||||
|
android:background="@drawable/bg_white_radius10_stroke2"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etInputGoods"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="输入物品名称"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="80dp"
|
||||||
|
android:textColor="#FF666666"
|
||||||
|
android:textColorHint="#FFC7C8DC"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:inputType="text"
|
||||||
|
android:imeOptions="actionSearch" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivGoodsSearch"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:padding="14dp"
|
||||||
|
android:src="@mipmap/ic_goods_search" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||||
|
android:id="@+id/refreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginHorizontal="130dp"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:layout_marginBottom="58dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/dividerLine"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/flSearchBlock">
|
||||||
|
|
||||||
|
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rvSearch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="2"
|
||||||
|
tools:itemCount="8"
|
||||||
|
tools:listitem="@layout/list_item_goods_search" />
|
||||||
|
|
||||||
|
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/dividerLine"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginHorizontal="40dp"
|
||||||
|
android:layout_marginBottom="160dp"
|
||||||
|
android:background="#FFDCDCF0"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnConfirm"
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/bg_blue_ripple"
|
||||||
|
android:text="确定"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/dividerLine" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="82dp"
|
||||||
|
android:layout_marginVertical="10dp"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
tools:background="@drawable/bg_white_stroke_blue_ripple">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvGoodsName"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:text="高杆白菜"
|
||||||
|
android:textColor="#ff666666"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivDelete"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:padding="25dp"
|
||||||
|
android:src="@mipmap/ic_close"/>
|
||||||
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user