[M2]回调后更新UI在主线程
This commit is contained in:
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.m2.p_m2_view_blue_tooth.view.*
|
||||
|
||||
@@ -24,10 +25,12 @@ class M2BlueToothView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun mofangStatus(status: Boolean) {
|
||||
if (status) {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_close)
|
||||
} else {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_open)
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (status) {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_close)
|
||||
} else {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_open)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystem
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.m2.p_m2_view_status_bar.view.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
@@ -69,14 +70,16 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
val bmsSoc = states.bmsSoc
|
||||
if(bmsSoc >1){
|
||||
progress.progress = bmsSoc.toInt()
|
||||
tv_power_cos.text = "${bmsSoc.toInt()}%"
|
||||
}else{
|
||||
val currenPower = (bmsSoc * 100).toInt()
|
||||
progress.progress = currenPower
|
||||
tv_power_cos.text = "$currenPower%"
|
||||
ThreadUtils.runOnUiThread {
|
||||
val bmsSoc = states.bmsSoc
|
||||
if(bmsSoc >1){
|
||||
progress.progress = bmsSoc.toInt()
|
||||
tv_power_cos.text = "${bmsSoc.toInt()}%"
|
||||
}else{
|
||||
val currenPower = (bmsSoc * 100).toInt()
|
||||
progress.progress = currenPower
|
||||
tv_power_cos.text = "$currenPower%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user