优化
This commit is contained in:
@@ -169,7 +169,6 @@ abstract class GoodsListActivity : BaseActivity() {
|
|||||||
binding.btnClearZero.setOnClickListener {
|
binding.btnClearZero.setOnClickListener {
|
||||||
SensorScaleUtils.tare()
|
SensorScaleUtils.tare()
|
||||||
}
|
}
|
||||||
cameraUtils.setPreviewController(previewView)
|
|
||||||
|
|
||||||
userViewModel.getInitInfo()
|
userViewModel.getInitInfo()
|
||||||
}
|
}
|
||||||
@@ -177,9 +176,10 @@ abstract class GoodsListActivity : BaseActivity() {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
cameraUtils.bind()
|
cameraUtils.bind()
|
||||||
|
cameraUtils.setPreviewController(previewView)
|
||||||
binding.root.postDelayed({
|
binding.root.postDelayed({
|
||||||
SensorScaleUtils.addWeightListener(weightIntCallback)
|
SensorScaleUtils.addWeightListener(weightIntCallback)
|
||||||
}, 1 * 1000)
|
}, 1 * 1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var weightIntCallback: WeightCallback = {
|
private var weightIntCallback: WeightCallback = {
|
||||||
@@ -478,6 +478,7 @@ abstract class GoodsListActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
SensorScaleUtils.removeWeightListener(weightIntCallback)
|
||||||
unBindCamera()
|
unBindCamera()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ object SensorScaleUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeWeightListener(callback: WeightCallback) {
|
||||||
|
if (callbackList.contains(callback)) {
|
||||||
|
callbackList.remove(callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启称重
|
* 开启称重
|
||||||
* @param autoScale 是否开启自动读取
|
* @param autoScale 是否开启自动读取
|
||||||
|
|||||||
Reference in New Issue
Block a user