[6.6.0] union the chassis state in one caller
This commit is contained in:
@@ -11,7 +11,6 @@ import android.view.animation.Animation
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.shuttle.passenger.R
|
||||
@@ -50,13 +49,11 @@ class BusPTurnLightView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
||||
|
||||
TurnLightManager.addTurnLightStatusChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
TurnLightManager.removeTurnLightStatusChangeListener(TAG)
|
||||
}
|
||||
|
||||
@@ -8,15 +8,16 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
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.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.shuttle.passenger.R
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.progress
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.tv_power_cos
|
||||
@@ -30,7 +31,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
class M2StatusBarView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener,
|
||||
IMoGoBatteryManagementSystemListener {
|
||||
IMoGoChassisStatesListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "M2StatusBarView"
|
||||
@@ -60,7 +61,7 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
//电量
|
||||
CallerBatteryManagementSystemListenerManager.addListener(TAG,this)
|
||||
CallerChassisStatesListenerManager.addListener(TAG,this)
|
||||
|
||||
progress?.also {
|
||||
it.progress = 50
|
||||
@@ -81,30 +82,33 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
super.onDetachedFromWindow()
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
CallerDevaToolsManager.hideStatusBar()
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
if (ClickUtils.isClickTooFrequent(this,1000)) {
|
||||
return
|
||||
}
|
||||
val bmsSoc = states.bmsSoc
|
||||
try {
|
||||
if (oldBmsSoc != bmsSoc ) {
|
||||
scope.launch {
|
||||
if(bmsSoc >1){
|
||||
progress?.also { it.progress = bmsSoc.toInt() }
|
||||
tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" }
|
||||
}else{
|
||||
val power = (bmsSoc * 100).toInt()
|
||||
progress?.also { it.progress = power }
|
||||
tv_power_cos?.also {it.text = "$power%" }
|
||||
ThreadUtils.runOnUiThread({
|
||||
if (ClickUtils.isClickTooFrequent(this,1000)) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
val bmsSoc = states.bmsSoc
|
||||
try {
|
||||
if (oldBmsSoc != bmsSoc ) {
|
||||
scope.launch {
|
||||
if(bmsSoc >1){
|
||||
progress?.also { it.progress = bmsSoc.toInt() }
|
||||
tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" }
|
||||
}else{
|
||||
val power = (bmsSoc * 100).toInt()
|
||||
progress?.also { it.progress = power }
|
||||
tv_power_cos?.also {it.text = "$power%" }
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
oldBmsSoc = bmsSoc
|
||||
}
|
||||
} finally {
|
||||
oldBmsSoc = bmsSoc
|
||||
}
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import android.view.animation.Animation
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.shuttle.passenger.R
|
||||
@@ -50,13 +49,11 @@ class M2TurnLightView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
||||
|
||||
TurnLightManager.addTurnLightStatusChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
TurnLightManager.removeTurnLightStatusChangeListener(TAG)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user