[6.5.0]fix bound must be positive bug

This commit is contained in:
xuxinchao
2024-07-15 18:15:47 +08:00
parent d7bc82fb68
commit 8628e8a970

View File

@@ -34,7 +34,7 @@ open class ItinerarySummaryDialog(context: Context, isDriver: Boolean, theme: In
private var tvEfficiencyNum: TextView ?= null //通行效率提升
private var travelRealityView: TravelRealityView ?= null
private val random = Random()
private var mileage: Float = 1000f //总里程
private var mileage: Float = 5000f //总里程
init {
this.mContext = context
@@ -107,7 +107,11 @@ open class ItinerarySummaryDialog(context: Context, isDriver: Boolean, theme: In
}
fun setOrderMileage(mileage: Float) {
this.mileage = mileage
if(mileage <= 0){
this.mileage = 5000f
}else{
this.mileage = mileage
}
if(this.isShowing){
showSummaryTipContent()
}
@@ -116,7 +120,6 @@ open class ItinerarySummaryDialog(context: Context, isDriver: Boolean, theme: In
private fun showSummaryTipContent(){
ThreadUtils.runOnUiThread {
val vehicleServiceNum = AutopilotSummaryInfo.infoTipNum+ AutopilotSummaryInfo.vehicleTipNum + AutopilotSummaryInfo.vulnerableTipNum + AutopilotSummaryInfo.lightServicesNum + CallerAutoPilotStatusListenerManager.getRoadCount()
val smartRoadLen = random.nextInt(mileage.toInt())
if(isDriver){
tvSummaryZhiContent?.text = "全程 ${(mileage/1000).toInt()}km智慧道路护航 ${(smartRoadLen/1000)}km全息感知覆盖率 ${(smartRoadLen*100/mileage).toInt()}%,车辆服务次数${vehicleServiceNum}"