优化
This commit is contained in:
@@ -154,9 +154,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
private var isStartRecognize = false
|
private var isStartRecognize = false
|
||||||
|
|
||||||
//0-联合支付,1-独立支付
|
//0-联合支付,1-独立支付
|
||||||
val settlementMode by lazy {
|
var settlementMode: Int = 1
|
||||||
SPUtil.getInstance().get(GlobalKey.KEY_SETTLEMENT_MODE, 1)
|
// val settlementMode by lazy {
|
||||||
}
|
// SPUtil.getInstance().get(GlobalKey.KEY_SETTLEMENT_MODE, 1)
|
||||||
|
// }
|
||||||
|
|
||||||
override fun getViewModel(): BaseViewModel {
|
override fun getViewModel(): BaseViewModel {
|
||||||
return viewModel
|
return viewModel
|
||||||
@@ -192,7 +193,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
return@runOnUiThread
|
return@runOnUiThread
|
||||||
}
|
}
|
||||||
//结算模式:1-独立支付,2-联合结算
|
//结算模式:1-独立支付,2-联合结算
|
||||||
val settlementMode = if (deviceConfig.payType == 2) 0 else 1
|
settlementMode = if (deviceConfig.payType == 2) 0 else 1
|
||||||
SPUtil.getInstance().put(GlobalKey.KEY_SETTLEMENT_MODE, settlementMode)
|
SPUtil.getInstance().put(GlobalKey.KEY_SETTLEMENT_MODE, settlementMode)
|
||||||
|
|
||||||
GlobalData.appId = deviceConfig.arcsoftAppId ?: ""
|
GlobalData.appId = deviceConfig.arcsoftAppId ?: ""
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.sw.dualscreen.BuildConfig
|
|||||||
import com.sw.dualscreen.MyApp
|
import com.sw.dualscreen.MyApp
|
||||||
import com.sw.dualscreen.network.api.ApiService
|
import com.sw.dualscreen.network.api.ApiService
|
||||||
import com.sw.dualscreen.network.interceptor.RequestInterceptor
|
import com.sw.dualscreen.network.interceptor.RequestInterceptor
|
||||||
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
@@ -20,14 +21,20 @@ object ApiClient {
|
|||||||
.connectTimeout(TIME_OUT, TimeUnit.SECONDS)
|
.connectTimeout(TIME_OUT, TimeUnit.SECONDS)
|
||||||
.readTimeout(TIME_OUT, TimeUnit.SECONDS)
|
.readTimeout(TIME_OUT, TimeUnit.SECONDS)
|
||||||
.writeTimeout(TIME_OUT, TimeUnit.SECONDS)
|
.writeTimeout(TIME_OUT, TimeUnit.SECONDS)
|
||||||
.addNetworkInterceptor(HttpLoggingInterceptor(logger = {
|
.addNetworkInterceptor(Interceptor {chain ->
|
||||||
Timber.d("okhttp logger ==>${it}")
|
val request = chain.request()
|
||||||
}).apply {
|
val url = request.url.toString()
|
||||||
level = if (BuildConfig.DEBUG) {
|
val tag = if (url.contains("terminal/neglect/common/app/faceFeature/increment/list")) "faceIncrement" else "ApiClient"
|
||||||
HttpLoggingInterceptor.Level.BODY
|
val loggingInterceptor = HttpLoggingInterceptor(logger = {
|
||||||
} else {
|
Timber.tag(tag).d("okhttp logger ==>${it}")
|
||||||
HttpLoggingInterceptor.Level.NONE
|
}).apply {
|
||||||
|
level = if (BuildConfig.DEBUG) {
|
||||||
|
HttpLoggingInterceptor.Level.BODY
|
||||||
|
} else {
|
||||||
|
HttpLoggingInterceptor.Level.NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
loggingInterceptor.intercept(chain)
|
||||||
})
|
})
|
||||||
.addInterceptor(RequestInterceptor())
|
.addInterceptor(RequestInterceptor())
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ class MainScreenPresentation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var isGoRecognize = true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示识别出的菜品信息
|
* 显示识别出的菜品信息
|
||||||
*/
|
*/
|
||||||
@@ -316,6 +318,7 @@ class MainScreenPresentation(
|
|||||||
//独立支队
|
//独立支队
|
||||||
loadUserNutritionData(userId)
|
loadUserNutritionData(userId)
|
||||||
}
|
}
|
||||||
|
step3Debouncer.reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,7 +705,7 @@ class MainScreenPresentation(
|
|||||||
private var lastAddWeight = 0
|
private var lastAddWeight = 0
|
||||||
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
|
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
|
||||||
Log.d(TAG, "addFoodToOrder: ${weight == lastAddWeight}")
|
Log.d(TAG, "addFoodToOrder: ${weight == lastAddWeight}")
|
||||||
if (weight == lastAddWeight) return
|
// if (weight == lastAddWeight) return
|
||||||
lastAddWeight = weight
|
lastAddWeight = weight
|
||||||
if (weight <= 10) {
|
if (weight <= 10) {
|
||||||
//0-即放即取,1-余量计量
|
//0-即放即取,1-余量计量
|
||||||
@@ -922,9 +925,15 @@ class MainScreenPresentation(
|
|||||||
Timber.tag(TAG).d("resumeCamera isRecognition = $isRecognition")
|
Timber.tag(TAG).d("resumeCamera isRecognition = $isRecognition")
|
||||||
isRecognition = true
|
isRecognition = true
|
||||||
if (rgbCameraHelper == null) {
|
if (rgbCameraHelper == null) {
|
||||||
|
Timber.tag(TAG).d("resumeCamera isRecognition ---1")
|
||||||
setupArcCamera()
|
setupArcCamera()
|
||||||
rgbCameraHelper!!.start()
|
binding.root.postDelayed({
|
||||||
|
if (rgbCameraHelper != null) {
|
||||||
|
rgbCameraHelper!!.start()
|
||||||
|
}
|
||||||
|
}, 2000)
|
||||||
} else if (rgbCameraHelper!!.isStopped) {
|
} else if (rgbCameraHelper!!.isStopped) {
|
||||||
|
Timber.tag(TAG).d("resumeCamera isRecognition ---2")
|
||||||
rgbCameraHelper!!.start()
|
rgbCameraHelper!!.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1000,9 +1009,12 @@ class MainScreenPresentation(
|
|||||||
activity,
|
activity,
|
||||||
Observer { compareResult: CompareResult ->
|
Observer { compareResult: CompareResult ->
|
||||||
if (currentStep != 2 || System.currentTimeMillis() - recognizeTime <= 2000) {
|
if (currentStep != 2 || System.currentTimeMillis() - recognizeTime <= 2000) {
|
||||||
//忽略非识别中及两秒内的再次识别
|
//忽略非识别中及5秒内的再次识别
|
||||||
return@Observer
|
return@Observer
|
||||||
}
|
}
|
||||||
|
// if (isGoRecognize.not()) {
|
||||||
|
// return@Observer
|
||||||
|
// }
|
||||||
recognizeTime = System.currentTimeMillis()
|
recognizeTime = System.currentTimeMillis()
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
activity.showWaitingDialog("加载中,请稍后……")
|
activity.showWaitingDialog("加载中,请稍后……")
|
||||||
|
|||||||
Reference in New Issue
Block a user