Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0

This commit is contained in:
yangyakun
2023-02-20 19:28:36 +08:00
40 changed files with 422 additions and 488 deletions

View File

@@ -87,7 +87,7 @@ dependencies {
api project(':test:crashreport-apmbyte')
compileOnly project(':core:function-impl:mogo-core-function-datacenter')
compileOnly project(':foudations:mogo-commons')
implementation project(':foudations:mogo-commons')
api project(':core:mogo-core-res')
compileOnly project(':core:mogo-core-utils')
compileOnly project(':core:mogo-core-function-call')

View File

@@ -33,7 +33,7 @@ class AccelerationFloatWindow constructor(activity: Activity) : View.OnTouchList
private var mInScreenY = 0f
init {
initFloatWindow();
initFloatWindow()
}
private fun initFloatWindow() {

View File

@@ -65,7 +65,7 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener {
private var ipcWarningReportList: List<ReportEntity>? = null//警告上报列表
init {
initFloatWindow();
initFloatWindow()
}
private fun initFloatWindow() {

View File

@@ -45,7 +45,9 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
defStyleAttr
), IMoGoAutopilotStatusListener {
private val TAG = "AutoPilotAndCheckView"
companion object{
private const val TAG = "AutoPilotAndCheckView"
}
private var clickListener: ClickListener? = null
private var keyBoardUtil: KeyBoardUtil? = null
@@ -57,10 +59,11 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
initView()
}
companion object {
private var maxAcceleration: Double = 2.0
private var speedLimit: Int = 0
}
@Volatile
private var maxAcceleration: Double = 2.0
@Volatile
private var speedLimit: Int = 0
@SuppressLint("ClickableViewAccessibility")
private fun initView() {

View File

@@ -30,7 +30,7 @@ class BusOperationView @JvmOverloads constructor(
context?.let {
actvAccountPhone.text = phoneMask(SharedPrefs.getInstance(it).getString("och_account",""))
}
clickPersonalRightView();
clickPersonalRightView()
}
private fun initPersonalIcon() {

View File

@@ -94,48 +94,51 @@ class PncActionsView @JvmOverloads constructor(
@BizConfig(FOUNDATION, "", BIZ_PNC_ACTIONS)
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
mAutoPilotStatusInfo?.let {
if (it.state == STATUS_AUTOPILOT_RUNNING) {
try {
mAutoPilotStatusInfo?.let {
UiThreadHandler.post {
var actions: String? = null
planningActionMsg.actionMsg?.let { it ->
try {
actions = PncActionsHelper.getAction(
it.drivingState.number,
it.drivingAction.number
)
} catch (e: Exception) {
e.printStackTrace()
if (it.state == STATUS_AUTOPILOT_RUNNING) {
var actions: String? = null
planningActionMsg.actionMsg?.let { it ->
try {
actions = PncActionsHelper.getAction(
it.drivingState.number,
it.drivingAction.number
)
} catch (e: Exception) {
e.printStackTrace()
}
//如果是存在云端红绿灯数据条件下,设置云端数据
if (PncActionsHelper.isWaitingTrafficlight(
it.drivingState.number,
it.drivingAction.number
)
&& mTrafficLightResult != null
&& getWaitTrafficLightTime().isNotBlank()
) {
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
} else {
mTrafficLightResult = null
}
}
//如果是存在云端红绿灯数据条件下,设置云端数据
if (PncActionsHelper.isWaitingTrafficlight(
it.drivingState.number,
it.drivingAction.number
)
&& mTrafficLightResult != null
&& getWaitTrafficLightTime().isNotBlank()
) {
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
// update view
if (actions.isNullOrEmpty()) {
this.background = null
tvHmiPncActions.text = ""
} else {
mTrafficLightResult = null
this.background =
AppCompatResources.getDrawable(context, bgResources)
tvHmiPncActions.text = actions
}
}
// update view
if (actions.isNullOrEmpty()) {
} else {
this.background = null
tvHmiPncActions.text = ""
} else {
this.background =
AppCompatResources.getDrawable(context, bgResources)
tvHmiPncActions.text = actions
}
}
} else {
this.background = null
tvHmiPncActions.text = ""
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {

View File

@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
/**
@@ -41,10 +42,12 @@ open class BlueToothView @JvmOverloads constructor(
override fun mofangStatus(status: Boolean) {
super.mofangStatus(status)
if (status) {
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
} else {
mofangView.setImageResource(R.drawable.blue_tooth)
ThreadUtils.runOnUiThread {
if (status) {
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
} else {
mofangView.setImageResource(R.drawable.blue_tooth)
}
}
}

View File

@@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.view_check_system.view.*
@@ -106,7 +107,9 @@ class CheckSystemView @JvmOverloads constructor(
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
connectStatus = autoPilotStatusInfo.connectStatus
autopilotStatus = autoPilotStatusInfo.state
setViewStatus()
ThreadUtils.runOnUiThread {
setViewStatus()
}
}
private fun setViewStatus() {

View File

@@ -8,7 +8,6 @@ import android.util.AttributeSet
import android.util.DisplayMetrics
import android.view.View
import android.view.animation.LinearInterpolator
import android.view.animation.OvershootInterpolator
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.function.hmi.R
@@ -22,7 +21,6 @@ class CircularProgressView @JvmOverloads constructor(
: View(context, attrs, defStyleAttr) {
val typedArray: TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
val TAG: String = "CircularProgressView"
// 绘制画笔
private val mBackPaint: Paint = Paint()
@@ -66,17 +64,17 @@ class CircularProgressView @JvmOverloads constructor(
} else {
mConvertColorsArray = null
}
typedArray.recycle();
typedArray.recycle()
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
val viewWide = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
val viewHigh = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
val viewWide = measuredWidth - paddingLeft - paddingRight
val viewHigh = measuredHeight - paddingTop - paddingBottom
val mRectLength =
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
val mRectL = getPaddingLeft() + (viewWide - mRectLength) / 2
val mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2
val mRectL = paddingLeft + (viewWide - mRectLength) / 2
val mRectT = paddingTop + (viewHigh - mRectLength) / 2
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
(mRectT + mRectLength).toFloat())
@@ -94,13 +92,13 @@ class CircularProgressView @JvmOverloads constructor(
return
}
val position = FloatArray(2)
position[0] = 0.0f;
position[0] = 0.0f
position[1] = mProgress.toFloat() * 0.01f
val sweepGradient = SweepGradient((measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat(), mConvertColorsArray!!, position)
val matrix = Matrix()
matrix.setRotate(-90F, (measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat())
sweepGradient.setLocalMatrix(matrix);
mProgPaint.setShader(sweepGradient)
mProgPaint.shader = sweepGradient
}
override fun onDraw(canvas: Canvas?) {
@@ -109,7 +107,7 @@ class CircularProgressView @JvmOverloads constructor(
mRectF?.let { it1 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
mRectF?.let { it1 ->
sweepGradient()
var degree: Float = 3.6f * (mProgress.toFloat())
val degree: Float = 3.6f * (mProgress.toFloat())
if(mProgress>=0) {
it.drawArc(it1, 275.0f, degree, false, mProgPaint)
}else{
@@ -121,8 +119,8 @@ class CircularProgressView @JvmOverloads constructor(
}
fun setBlurMaskFilter(blur: BlurMaskFilter.Blur, radius: Float) {
var blur: BlurMaskFilter = BlurMaskFilter(radius, blur)
mProgPaint.setMaskFilter(blur)
val temp = BlurMaskFilter(radius, blur)
mProgPaint.maskFilter = temp
invalidate()
}
@@ -222,12 +220,11 @@ class CircularProgressView @JvmOverloads constructor(
return
}
mConvertColorsArray = it.copyOf()
mConvertColorsArray?.let {
mConvertColorsArray?.let { color ->
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
measuredWidth.toFloat(), color, null, Shader.TileMode.MIRROR)
}
}
}
}

View File

@@ -1,252 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
/**
* @author Jing
* @description 方向盘
* 方向盘跟随CAN数据做旋转
* 档位随CAN数据做切换和高亮显示
* @since: 4/7/22
*/
public class SteeringWheelView extends ConstraintLayout implements
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener {
private static final String TAG = "SteeringWheelView";
private ImageView autopilotIV;
private TextView steeringTVL;
private TextView steeringTVR;
private TapPositionView tapPositionView;
private CircularProgressView steeringCircularV;
private CircularProgressView steeringCircularVAlpha;
private RotateAnimation rotateAnimation;
private float fromDegrees = 0;//方向盘旋转起始位置
public SteeringWheelView(@NonNull Context context) {
super(context);
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel_bus, this);
} else {
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel_taxi, this);
}
initView();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
tapPositionView.updateWithGear(Chassis.GearPosition.GEAR_R);
}
private void initView() {
autopilotIV = (ImageView) findViewById(R.id.autopilot_iv);
steeringTVL = findViewById(R.id.steering_tv_left);
steeringTVR = findViewById(R.id.steering_tv_right);
tapPositionView = findViewById(R.id.tap_position);
steeringCircularV = findViewById(R.id.steering_circular);
steeringCircularV.setBackWidth(8);
steeringCircularV.setBackColor(R.color.hmi_light_back_bg);
steeringCircularV.setProgress((int) (0 * 100) / 360, 20);
steeringCircularV.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue);
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
steeringCircularVAlpha = findViewById(R.id.steering_circular_alpha);
steeringCircularVAlpha.setProgress((int) (0 * 100) / 360, 20);
steeringCircularV.setProgColor(R.color.hmi_dark_blue, R.color.hmi_light_blue);
steeringCircularVAlpha.setBackWidth(8);
steeringCircularVAlpha.setBackColor(R.color.hmi_clear_00);
steeringCircularVAlpha.setProgColor(R.color.hmi_light_blue_alpha_ff, R.color.hmi_light_blue_alpha_00);
steeringCircularVAlpha.setBlurMaskFilter(BlurMaskFilter.Blur.NORMAL, 12);
}
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}
@Override
public void onAutopilotArriveAtStation(@org.jetbrains.annotations.Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (autopilotStatusInfo == null) return;
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "state = %s", state);
if (autopilotIV != null) {
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
// TODO
} else {
autopilotIV.setImageResource(R.drawable.bg_auto);
}
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
// TODO
} else {
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
}
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
// TODO
} else {
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
}
}
} else {
CallerLogger.INSTANCE.d(TAG, "autopilotIV=null");
}
}
});
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
};
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
if (Math.abs(steering) < 1) {
steering = 0;
}
float steeringValue = steering;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (steeringTVL != null && steeringValue > 0) {
steeringTVR.setVisibility(View.INVISIBLE);
steeringTVL.setVisibility(View.VISIBLE);
steeringTVL.setText(String.valueOf((int) steeringValue) + "°");
} else if (steeringTVR != null && steeringValue <= 0) {
steeringTVL.setVisibility(View.INVISIBLE);
steeringTVR.setVisibility(View.VISIBLE);
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
} else {
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
}
animationWithSteeringData(-steeringValue);
if (steeringCircularV != null) {
steeringCircularV.setProgress((int) (-steeringValue * 100) / 360, 20);
}
if (steeringCircularVAlpha != null) {
steeringCircularVAlpha.setProgress((int) (-steeringValue * 100) / 360, 20);
}
}
});
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
}
});
}
/**
* 方向盘随CAN数据做方向和角度旋转
* 参数1从哪一个旋转角度开始
* 参数2转到什么角度
* 后4个参数用于设置围绕着旋转的圆的圆心在哪里
* 参数3肯定x轴坐标的类型有ABSOLUT绝对坐标、RELATIVE_TO_SELF相对于自身坐标、RELATIVE_TO_PARENT相对于父控件的坐标
* 参数4x轴的值0.5f代表是以自身这个控件的一半长度为x轴
* 参数5肯定y轴坐标的类型
* 参数6y轴的值0.5f代表是以自身这个控件的一半长度为x轴
*
* @param steering
*/
private void animationWithSteeringData(float steering) {
rotateAnimation = new RotateAnimation(fromDegrees, steering,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(20);//旋转时长
rotateAnimation.setFillAfter(true);//旋转后保持原状
autopilotIV.clearAnimation();
autopilotIV.startAnimation(rotateAnimation);
fromDegrees = steering;
}
}

View File

@@ -0,0 +1,192 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.graphics.BlurMaskFilter
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.animation.RotateAnimation
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis.GearPosition
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isBus
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlin.math.abs
/**
* @author Jing
* @description 方向盘
* 方向盘跟随CAN数据做旋转
* 档位随CAN数据做切换和高亮显示
* @since: 4/7/22
*/
class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener {
private var autopilotIV: ImageView? = null
private var steeringTVL: TextView? = null
private var steeringTVR: TextView? = null
private var tapPositionView: TapPositionView? = null
private var steeringCircularV: CircularProgressView? = null
private var steeringCircularVAlpha: CircularProgressView? = null
private var rotateAnimation: RotateAnimation? = null
private var fromDegrees = 0f //方向盘旋转起始位置
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
if (isBus(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel_bus, this)
} else {
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel_taxi, this)
}
initView()
CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
CallerChassisGearStateListenerManager.addListener(TAG, this)
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
tapPositionView?.updateWithGear(GearPosition.GEAR_R)
}
private fun initView() {
autopilotIV = findViewById<View>(R.id.autopilot_iv) as ImageView
steeringTVL = findViewById(R.id.steering_tv_left)
steeringTVR = findViewById(R.id.steering_tv_right)
tapPositionView = findViewById(R.id.tap_position)
steeringCircularV = findViewById(R.id.steering_circular)
steeringCircularV?.setBackWidth(8)
steeringCircularV?.setBackColor(R.color.hmi_light_back_bg)
steeringCircularV?.setProgress((0 * 100) / 360, 20)
steeringCircularV?.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue)
if (isTaxi(FunctionBuildConfig.appIdentityMode)) {
steeringCircularVAlpha = findViewById(R.id.steering_circular_alpha)
steeringCircularVAlpha?.setProgress((0 * 100) / 360, 20)
steeringCircularV?.setProgColor(R.color.hmi_dark_blue, R.color.hmi_light_blue)
steeringCircularVAlpha?.setBackWidth(8)
steeringCircularVAlpha?.setBackColor(R.color.hmi_clear_00)
steeringCircularVAlpha?.setProgColor(
R.color.hmi_light_blue_alpha_ff,
R.color.hmi_light_blue_alpha_00
)
steeringCircularVAlpha?.setBlurMaskFilter(BlurMaskFilter.Blur.NORMAL, 12f)
}
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
}
private val mGoAutopilotStatusListener: IMoGoAutopilotStatusListener =
object : IMoGoAutopilotStatusListener {
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
ThreadUtils.runOnUiThread {
val state = autoPilotStatusInfo.state
d("$M_BUS_P$TAG", "state = %s", state)
if (autopilotIV != null) {
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (!isBus(FunctionBuildConfig.appIdentityMode)) {
autopilotIV?.setImageResource(R.drawable.bg_auto)
}
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
if (!isBus(FunctionBuildConfig.appIdentityMode)) {
autopilotIV?.setImageResource(R.drawable.bg_auto_nor)
}
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
if (!isBus(FunctionBuildConfig.appIdentityMode)) {
autopilotIV?.setImageResource(R.drawable.bg_auto_nor)
}
}
} else {
d("$M_BUS_P$TAG", "autopilotIV=null")
}
}
}
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
override fun onAutopilotSteeringData(steering: Float) {
var temp = steering
if (abs(steering) < 1) {
temp = 0f
}
val steeringValue = temp
ThreadUtils.runOnUiThread {
if (steeringTVL != null && steeringValue > 0) {
steeringTVR?.visibility = INVISIBLE
steeringTVL?.visibility = VISIBLE
steeringTVL?.text = "${steeringValue}°"
} else if (steeringTVR != null && steeringValue <= 0) {
steeringTVL?.visibility = INVISIBLE
steeringTVR?.visibility = VISIBLE
steeringTVR?.text = "${-steeringValue}°"
} else {
d(TAG, "onAutopilotSteeringData error")
}
animationWithSteeringData(-steeringValue)
if (steeringCircularV != null) {
steeringCircularV?.setProgress((-steeringValue * 100).toInt() / 360, 20)
}
if (steeringCircularVAlpha != null) {
steeringCircularVAlpha?.setProgress((-steeringValue * 100).toInt() / 360, 20)
}
}
}
/**
* 档位
* @param gear
*/
override fun onAutopilotGearData(gear: GearPosition) {
ThreadUtils.runOnUiThread {
d(TAG, "乘客屏档位$gear")
if (tapPositionView != null) {
tapPositionView?.updateWithGear(gear)
}
}
}
/**
* 方向盘随CAN数据做方向和角度旋转
* 参数1从哪一个旋转角度开始
* 参数2转到什么角度
* 后4个参数用于设置围绕着旋转的圆的圆心在哪里
* 参数3肯定x轴坐标的类型有ABSOLUT绝对坐标、RELATIVE_TO_SELF相对于自身坐标、RELATIVE_TO_PARENT相对于父控件的坐标
* 参数4x轴的值0.5f代表是以自身这个控件的一半长度为x轴
* 参数5肯定y轴坐标的类型
* 参数6y轴的值0.5f代表是以自身这个控件的一半长度为x轴
*
* @param steering
*/
private fun animationWithSteeringData(steering: Float) {
rotateAnimation = RotateAnimation(
fromDegrees, steering,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f
)
rotateAnimation?.duration = 20 //旋转时长
rotateAnimation?.fillAfter = true //旋转后保持原状
autopilotIV?.clearAnimation()
autopilotIV?.startAnimation(rotateAnimation)
fromDegrees = steering
}
companion object {
private const val TAG = "SteeringWheelView"
}
}

View File

@@ -69,14 +69,6 @@ class SystemVersionView @JvmOverloads constructor(
ivPadVersion.setOnClickListener {
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
CallerDevaToolsManager.queryAppUpgrade()
//弹框和下载回调
// showUpgradeDialog(
// "",
// "",
// "",
// "",
// "1"
// )
}
//工控机版本视图点击事件

View File

@@ -14,7 +14,7 @@ import com.kwai.koom.nativeoom.leakmonitor.LeakListener
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor.start
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord
import com.mogo.commons.analytics.AnalyticsUtils
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
@@ -158,7 +158,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
properties["app_launch_hotStartTime"] = hotStartTime
}
}
AnalyticsUtils.track("app_launch_time", properties)
MogoAnalyticUtils.track("app_launch_time", properties)
}
}

View File

@@ -9,8 +9,10 @@ import android.os.Process;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.MogoModule;
import com.mogo.commons.module.MogoModulePaths;
import com.mogo.commons.utils.MogoAnalyticUtils;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
@@ -111,6 +113,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
} catch (Exception e) {
e.printStackTrace();
}
// 初始化埋点
MogoAnalyticUtils.INSTANCE.init(this, DebugConfig.isDebug());
SocketBuildConfig.isPrintLog = false;
// 初始化DevaTools,开始链路记录
CallerDevaToolsManager.INSTANCE.init();