[2.13.0-arch-opt] view check
This commit is contained in:
@@ -33,7 +33,7 @@ class AccelerationFloatWindow constructor(activity: Activity) : View.OnTouchList
|
|||||||
private var mInScreenY = 0f
|
private var mInScreenY = 0f
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initFloatWindow();
|
initFloatWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initFloatWindow() {
|
private fun initFloatWindow() {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener {
|
|||||||
private var ipcWarningReportList: List<ReportEntity>? = null//警告上报列表
|
private var ipcWarningReportList: List<ReportEntity>? = null//警告上报列表
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initFloatWindow();
|
initFloatWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initFloatWindow() {
|
private fun initFloatWindow() {
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
|||||||
defStyleAttr
|
defStyleAttr
|
||||||
), IMoGoAutopilotStatusListener {
|
), IMoGoAutopilotStatusListener {
|
||||||
|
|
||||||
private val TAG = "AutoPilotAndCheckView"
|
companion object{
|
||||||
|
private const val TAG = "AutoPilotAndCheckView"
|
||||||
|
}
|
||||||
|
|
||||||
private var clickListener: ClickListener? = null
|
private var clickListener: ClickListener? = null
|
||||||
private var keyBoardUtil: KeyBoardUtil? = null
|
private var keyBoardUtil: KeyBoardUtil? = null
|
||||||
@@ -57,10 +59,11 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
|||||||
initView()
|
initView()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
@Volatile
|
||||||
private var maxAcceleration: Double = 2.0
|
private var maxAcceleration: Double = 2.0
|
||||||
private var speedLimit: Int = 0
|
|
||||||
}
|
@Volatile
|
||||||
|
private var speedLimit: Int = 0
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private fun initView() {
|
private fun initView() {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class BusOperationView @JvmOverloads constructor(
|
|||||||
context?.let {
|
context?.let {
|
||||||
actvAccountPhone.text = phoneMask(SharedPrefs.getInstance(it).getString("och_account",""))
|
actvAccountPhone.text = phoneMask(SharedPrefs.getInstance(it).getString("och_account",""))
|
||||||
}
|
}
|
||||||
clickPersonalRightView();
|
clickPersonalRightView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initPersonalIcon() {
|
private fun initPersonalIcon() {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
|||||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||||
import com.mogo.eagle.core.function.hmi.R
|
import com.mogo.eagle.core.function.hmi.R
|
||||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
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.*
|
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
|
||||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 魔戒蓝牙控件
|
* 魔戒蓝牙控件
|
||||||
@@ -42,10 +42,12 @@ class BlueToothView @JvmOverloads constructor(
|
|||||||
|
|
||||||
override fun mofangStatus(status: Boolean) {
|
override fun mofangStatus(status: Boolean) {
|
||||||
super.mofangStatus(status)
|
super.mofangStatus(status)
|
||||||
if (status) {
|
ThreadUtils.runOnUiThread {
|
||||||
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
|
if (status) {
|
||||||
} else {
|
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
|
||||||
mofangView.setImageResource(R.drawable.blue_tooth)
|
} else {
|
||||||
|
mofangView.setImageResource(R.drawable.blue_tooth)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.R
|
||||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||||
import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog
|
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 com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
import kotlinx.android.synthetic.main.view_check_system.view.*
|
import kotlinx.android.synthetic.main.view_check_system.view.*
|
||||||
|
|
||||||
@@ -106,7 +107,9 @@ class CheckSystemView @JvmOverloads constructor(
|
|||||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||||
connectStatus = autoPilotStatusInfo.connectStatus
|
connectStatus = autoPilotStatusInfo.connectStatus
|
||||||
autopilotStatus = autoPilotStatusInfo.state
|
autopilotStatus = autoPilotStatusInfo.state
|
||||||
setViewStatus()
|
ThreadUtils.runOnUiThread {
|
||||||
|
setViewStatus()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setViewStatus() {
|
private fun setViewStatus() {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import android.util.AttributeSet
|
|||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
import android.view.animation.OvershootInterpolator
|
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.mogo.eagle.core.function.hmi.R
|
import com.mogo.eagle.core.function.hmi.R
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@ class CircularProgressView @JvmOverloads constructor(
|
|||||||
: View(context, attrs, defStyleAttr) {
|
: View(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
val typedArray: TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
|
val typedArray: TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
|
||||||
val TAG: String = "CircularProgressView"
|
|
||||||
|
|
||||||
// 绘制画笔
|
// 绘制画笔
|
||||||
private val mBackPaint: Paint = Paint()
|
private val mBackPaint: Paint = Paint()
|
||||||
@@ -66,17 +64,17 @@ class CircularProgressView @JvmOverloads constructor(
|
|||||||
} else {
|
} else {
|
||||||
mConvertColorsArray = null
|
mConvertColorsArray = null
|
||||||
}
|
}
|
||||||
typedArray.recycle();
|
typedArray.recycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
val viewWide = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
|
val viewWide = measuredWidth - paddingLeft - paddingRight
|
||||||
val viewHigh = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
|
val viewHigh = measuredHeight - paddingTop - paddingBottom
|
||||||
val mRectLength =
|
val mRectLength =
|
||||||
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
|
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
|
||||||
val mRectL = getPaddingLeft() + (viewWide - mRectLength) / 2
|
val mRectL = paddingLeft + (viewWide - mRectLength) / 2
|
||||||
val mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2
|
val mRectT = paddingTop + (viewHigh - mRectLength) / 2
|
||||||
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
|
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
|
||||||
(mRectT + mRectLength).toFloat())
|
(mRectT + mRectLength).toFloat())
|
||||||
|
|
||||||
@@ -94,13 +92,13 @@ class CircularProgressView @JvmOverloads constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val position = FloatArray(2)
|
val position = FloatArray(2)
|
||||||
position[0] = 0.0f;
|
position[0] = 0.0f
|
||||||
position[1] = mProgress.toFloat() * 0.01f
|
position[1] = mProgress.toFloat() * 0.01f
|
||||||
val sweepGradient = SweepGradient((measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat(), mConvertColorsArray!!, position)
|
val sweepGradient = SweepGradient((measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat(), mConvertColorsArray!!, position)
|
||||||
val matrix = Matrix()
|
val matrix = Matrix()
|
||||||
matrix.setRotate(-90F, (measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat())
|
matrix.setRotate(-90F, (measuredWidth / 2).toFloat(), (measuredHeight / 2).toFloat())
|
||||||
sweepGradient.setLocalMatrix(matrix);
|
sweepGradient.setLocalMatrix(matrix);
|
||||||
mProgPaint.setShader(sweepGradient)
|
mProgPaint.shader = sweepGradient
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas?) {
|
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 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
|
||||||
mRectF?.let { it1 ->
|
mRectF?.let { it1 ->
|
||||||
sweepGradient()
|
sweepGradient()
|
||||||
var degree: Float = 3.6f * (mProgress.toFloat())
|
val degree: Float = 3.6f * (mProgress.toFloat())
|
||||||
if(mProgress>=0) {
|
if(mProgress>=0) {
|
||||||
it.drawArc(it1, 275.0f, degree, false, mProgPaint)
|
it.drawArc(it1, 275.0f, degree, false, mProgPaint)
|
||||||
}else{
|
}else{
|
||||||
@@ -121,8 +119,8 @@ class CircularProgressView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setBlurMaskFilter(blur: BlurMaskFilter.Blur, radius: Float) {
|
fun setBlurMaskFilter(blur: BlurMaskFilter.Blur, radius: Float) {
|
||||||
var blur: BlurMaskFilter = BlurMaskFilter(radius, blur)
|
val temp = BlurMaskFilter(radius, blur)
|
||||||
mProgPaint.setMaskFilter(blur)
|
mProgPaint.maskFilter = temp
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,12 +220,11 @@ class CircularProgressView @JvmOverloads constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mConvertColorsArray = it.copyOf()
|
mConvertColorsArray = it.copyOf()
|
||||||
mConvertColorsArray?.let {
|
mConvertColorsArray?.let { color ->
|
||||||
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
|
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
|
||||||
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
|
measuredWidth.toFloat(), color, null, Shader.TileMode.MIRROR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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相对于父控件的坐标
|
|
||||||
* 参数4:x轴的值,0.5f代表是以自身这个控件的一半长度为x轴
|
|
||||||
* 参数5:肯定y轴坐标的类型
|
|
||||||
* 参数6:y轴的值,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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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相对于父控件的坐标
|
||||||
|
* 参数4:x轴的值,0.5f代表是以自身这个控件的一半长度为x轴
|
||||||
|
* 参数5:肯定y轴坐标的类型
|
||||||
|
* 参数6:y轴的值,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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,14 +69,6 @@ class SystemVersionView @JvmOverloads constructor(
|
|||||||
ivPadVersion.setOnClickListener {
|
ivPadVersion.setOnClickListener {
|
||||||
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
|
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
|
||||||
CallerDevaToolsManager.queryAppUpgrade()
|
CallerDevaToolsManager.queryAppUpgrade()
|
||||||
//弹框和下载回调
|
|
||||||
// showUpgradeDialog(
|
|
||||||
// "",
|
|
||||||
// "",
|
|
||||||
// "",
|
|
||||||
// "",
|
|
||||||
// "1"
|
|
||||||
// )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//工控机版本视图点击事件
|
//工控机版本视图点击事件
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ object CallerMapUIServiceManager {
|
|||||||
return serviceProvider?.overlayManager
|
return serviceProvider?.overlayManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo emArrow
|
||||||
fun getGDLocationServer(context: Context): IMogoGDLocationClient?{
|
fun getGDLocationServer(context: Context): IMogoGDLocationClient?{
|
||||||
return serviceProvider?.getGDLocationServer(context)
|
return serviceProvider?.getGDLocationServer(context)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user