[add] 乘客屏速度数据信息

This commit is contained in:
liujing
2022-06-25 22:44:30 +08:00
parent beaf3835d0
commit 7386dbe0a3
16 changed files with 406 additions and 81 deletions

View File

@@ -776,7 +776,7 @@ class DebugSettingView @JvmOverloads constructor(
SharedPrefsMgr.getInstance(context)
.getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP)
etAutopilotIP.setText("192.168.1.102")
etAutopilotIP.setText("172.30.10.10:41102")
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
//设置工控机IP
btnSetAutopilotIP.setOnClickListener {

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;
@@ -30,7 +31,7 @@ public class TapPositionView extends ConstraintLayout {
private TextView tabR;
private TextView tabN;
private TextView tabD;
private TypedArray typedArray;
public TapPositionView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Log.d(TAG, "2");
@@ -39,6 +40,8 @@ public class TapPositionView extends ConstraintLayout {
tabR = findViewById(R.id.tap_r);
tabN = findViewById(R.id.tap_n);
tabD = findViewById(R.id.tap_d);
typedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView);
}
public void updateWithGear(@NotNull Chassis.GearPosition gear) {
@@ -125,4 +128,64 @@ public class TapPositionView extends ConstraintLayout {
break;
}
}
/**
* 司机屏档位信息
*/
public void updateWithGearForDriverPanel(@NotNull Chassis.GearPosition gear) {
if (tabP != null && tabR != null && tabN != null && tabD != null) {
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
busDriverPanel(gear);
} else {
busDriverPanel(gear);
}
}
}
private void busDriverPanel(@NotNull Chassis.GearPosition gear) {
Log.d(TAG, "gear" + gear.toString());
tabP.setTextSize(36f);
tabR.setTextSize(36f);
tabN.setTextSize(36f);
tabD.setTextSize(36f);
int defaultColor = typedArray.getColor(R.styleable.TapPositionView_defaultColor, -1);
int selectColor = typedArray.getColor(R.styleable.TapPositionView_selectColor, -1);
switch (gear) {
case GEAR_NONE:
tabP.setTextColor(Color.parseColor("#FFF"));
tabR.setTextColor(Color.parseColor("#FFF"));
tabN.setTextColor(Color.parseColor("#FFF"));
tabD.setTextColor(Color.parseColor("#FFF"));
break;
case GEAR_P:
tabP.setTextColor(Color.parseColor("#343c63"));
tabR.setTextColor(Color.parseColor("#FFF"));
tabN.setTextColor(Color.parseColor("#FFF"));
tabD.setTextColor(Color.parseColor("#FFF"));
break;
case GEAR_R:
tabR.setTextColor(Color.parseColor("#343c63"));
tabP.setTextColor(Color.parseColor("#FFF"));
tabN.setTextColor(Color.parseColor("#FFF"));
tabD.setTextColor(Color.parseColor("#FFF"));
break;
case GEAR_N:
tabN.setTextColor(Color.parseColor("#343c63"));
tabR.setTextColor(Color.parseColor("#FFF"));
tabP.setTextColor(Color.parseColor("#FFF"));
tabD.setTextColor(Color.parseColor("#FFF"));
break;
case GEAR_D:
tabD.setTextColor(selectColor);
tabN.setTextColor(defaultColor);
tabR.setTextColor(defaultColor);
tabP.setTextColor(defaultColor);
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,151 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
/**
* @author Jing
* @description 速度 加速度 档位 刹车 油门状态值
* @since: 6/24/22
*/
public class TrafficDataView extends ConstraintLayout {
private static final String TAG = "TrafficDataView";
private TapPositionView tapPositionView;
//圆弧颜色
private int mArcColor;
public TrafficDataView(@NonNull Context context) {
super(context);
}
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
}
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this);
} else {
}
LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this);
tapPositionView = findViewById(R.id.traffic_position);
}
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
Log.d(TAG, "车辆转向灯:" + lightSwitch.toString());
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight));
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
Log.d(TAG, "steering原始值====" + String.valueOf(steering));
if (Math.abs(steering) < 1) {
steering = 0;
}
float steeringValue = steering;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d(TAG, "steering忽略小数点后====" + String.valueOf((int) steeringValue));
}
});
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d(TAG, "司机屏档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGearForDriverPanel(gear);
}
}
});
}
@Override
public void onAutopilotDataException(long timestamp) {
}
};
/**
* 设置弧形颜色
*
* @param value 颜色值
*/
public void setArcColor(int value) {
mArcColor = value;
}
/**
* 设置数据
*
* @param value 当前绘制的值
*/
public void setValues(int value) {
}
/**
* 车速过快
*/
public void showWithSpeedValue(int newSpeed){
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
android:background="@drawable/traffic_data_back">
<ImageView
android:id="@+id/speedImage"
android:layout_width="@dimen/dp_270"
android:layout_height="@dimen/dp_270"
android:layout_marginLeft="@dimen/dp_46"
android:background="@drawable/traffic_data_speed"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/speedTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80px"
android:text="0"
android:textAlignment="center"
android:textColor="#fff"
android:textSize="@dimen/dp_70"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/speedImage"
app:layout_constraintRight_toRightOf="@+id/speedImage"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/kmTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_176"
android:text="KM/H"
android:textAlignment="center"
android:textColor="#fff"
android:textSize="@dimen/dp_30"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/speedImage"
app:layout_constraintRight_toRightOf="@+id/speedImage"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView
android:id="@+id/traffic_position"
android:layout_width="@dimen/dp_220"
app:defaultColor="@color/text_color_343c63"
app:selectColor="#FFF"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_80"
android:layout_marginRight="@dimen/dp_80"
app:layout_constraintLeft_toRightOf="@+id/speedImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/brakeStatus"
android:layout_width="@dimen/dp_66"
android:layout_height="@dimen/dp_68"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_174"
android:layout_marginBottom="@dimen/dp_57"
android:src="@drawable/traffic_data_empty"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/speedImage"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/speedAccTextView"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_56"
android:layout_marginLeft="@dimen/dp_42"
android:layout_marginTop="@dimen/dp_190"
android:text="a: "
android:textAlignment="center"
android:textColor="#fff"
android:textSize="@dimen/dp_40"
app:layout_constraintLeft_toLeftOf="@+id/brakeStatus"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,4 +6,5 @@
<color name="notice_check_dialog_bg_color">#E63B4577</color>
<color name="notice_traffic_line">#555C7E</color>
<color name="notice_dialog_back">#3B4577</color>
<color name="text_color_343c63">#343C63</color>
</resources>

View File

@@ -49,4 +49,8 @@
<attr name="progress" format="integer" /> <!--圆环进度-->
</declare-styleable>
<declare-styleable name="TapPositionView">
<attr name="defaultColor" format="color"/> <!--档位默认色值-->
<attr name="selectColor" format="color"/> <!--当前档位色值-->
</declare-styleable>
</resources>

View File

@@ -60,4 +60,5 @@
<color name="hmi_light_blue_alpha_00">#D945D3FF</color>
<color name="hmi_light_blue_alpha_ff">#D93261B6</color>
<color name="hmi_clear_00">#00FFFFFF</color>
<color name="text_color_343c63">#343C63</color>
</resources>

View File

@@ -131,16 +131,16 @@ public class AMapCustomView
sList.add(mStartLatlng);
eList.add(mEndLatlng);
//测试代码:路线指定路径328线路
mWayPointList.add(new NaviLatLng(39.968847, 116.406952));
mWayPointList.add(new NaviLatLng(39.969058, 116.407346));
mWayPointList.add(new NaviLatLng(39.968955, 116.401767));
mWayPointList.add(new NaviLatLng(39.968626, 116.394938));
mWayPointList.add(new NaviLatLng(39.968433, 116.388725));
mWayPointList.add(new NaviLatLng(39.968542, 116.383775));
mWayPointList.add(new NaviLatLng(40.037808, 116.342539));
mWayPointList.add(new NaviLatLng(40.037239, 116.337172));
mWayPointList.add(new NaviLatLng(40.035897, 116.329582));
mWayPointList.add(new NaviLatLng(40.036396, 116.322166));
// mWayPointList.add(new NaviLatLng(39.968847, 116.406952));
// mWayPointList.add(new NaviLatLng(39.969058, 116.407346));
// mWayPointList.add(new NaviLatLng(39.968955, 116.401767));
// mWayPointList.add(new NaviLatLng(39.968626, 116.394938));
// mWayPointList.add(new NaviLatLng(39.968433, 116.388725));
// mWayPointList.add(new NaviLatLng(39.968542, 116.383775));
// mWayPointList.add(new NaviLatLng(40.037808, 116.342539));
// mWayPointList.add(new NaviLatLng(40.037239, 116.337172));
// mWayPointList.add(new NaviLatLng(40.035897, 116.329582));
// mWayPointList.add(new NaviLatLng(40.036396, 116.322166));
//顺义国展路线
// mWayPointList.add(new NaviLatLng(40.097621,116.526495));
@@ -243,7 +243,7 @@ public class AMapCustomView
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
Log.d(TAG, "高精定位onLocationChanged" + location.toString());
}
private void removeLocation(Location latLng) {