Merge branch 'local_282_navi' into feat_overview_mode_282

This commit is contained in:
liujing
2022-06-27 19:43:35 +08:00
16 changed files with 523 additions and 135 deletions

View File

@@ -61,12 +61,14 @@ dependencies {
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -73,6 +74,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private Group groupTestPanel;
private FrameLayout flSpeed;
private BusArcView mouduleArc;
private TrafficDataView dataView;
private ImageView mUpgradeTipIv;
// private BusTrafficLightView mTrafficLightView;
@@ -478,6 +480,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
*/
public void updateSpeedView(float newSpeed) {
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
// dataView.showWithSpeedValue(speed);
mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
mouduleArc.setValues(speed);
flSpeed.setBackgroundResource(speed > 60 ? R.drawable.bus_yi_biao_pan_bg_speeding : R.drawable.bus_yi_biao_pan_bg_nor);

View File

@@ -5,37 +5,43 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/bus_ext_speed_width"
android:layout_height="@dimen/bus_ext_speed_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginTop="@dimen/module_mogo_och_margin_left"
android:background="@drawable/bus_yi_biao_pan_bg_nor"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_40"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.och.bus.view.BusArcView
android:id="@+id/bus_arc"
android:layout_width="@dimen/bus_ext_arcView_width"
android:layout_height="@dimen/bus_ext_arcView_height"
android:layout_gravity="center" />
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView-->
<!-- android:id="@+id/bus_arc"-->
<!-- android:layout_width="@dimen/dp_616"-->
<!-- android:layout_height="@dimen/dp_320"-->
<!-- android:layout_gravity="center" />-->
</FrameLayout>
<com.mogo.och.bus.view.BusArcView
android:id="@+id/bus_arc"
android:layout_width="@dimen/bus_ext_arcView_width"
android:layout_height="@dimen/bus_ext_arcView_height"
android:layout_gravity="center" />
</FrameLayout>
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
android:layout_marginTop="@dimen/bus_ext_arcView_top"
android:background="@drawable/bus_autopilot_status_bg"
app:layout_constraintLeft_toLeftOf="parent"
android:gravity="center"
tools:visibility="visible" >
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
tools:visibility="visible">
<ImageView
android:id="@+id/bus_autopilot_btn_iv"
@@ -43,17 +49,18 @@
android:layout_height="56px"
android:layout_centerVertical="true"
android:src="@drawable/bus_ic_autopilot" />
<TextView
android:id="@+id/bus_autopolot_btn_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自动驾驶"
android:layout_centerVertical="true"
android:layout_marginLeft="28px"
android:layout_toRightOf="@+id/bus_autopilot_btn_iv"
android:text="自动驾驶"
android:textColor="@color/bus_autopilot_text_color_normal"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:layout_centerVertical="true"
android:textStyle="bold"/>
android:textStyle="bold" />
</RelativeLayout>
@@ -71,28 +78,31 @@
tools:visibility="visible" />
<!--切换地图远近事件 @dimen/module_switch_map -->
<LinearLayout
android:id="@+id/bus_switch_model_layout"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:background="@drawable/bus_switch_map_bg"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_operation_status"
app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_operation_status"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/bus_switch_model_layout"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:background="@drawable/bus_switch_map_bg"
android:elevation="@dimen/bus_dp_10"
android:gravity="center"
android:orientation="horizontal"
android:padding="@dimen/bus_dp_20"
app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_operation_status"
app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_operation_status">
<ImageView
android:id="@+id/bus_switch_model_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="@+id/bus_switch_model_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<CheckedTextView
android:id="@+id/module_mogo_och_operation_status"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:background="@drawable/bus_operation_status_bg"
android:elevation="@dimen/dp_10"
android:gravity="center"
@@ -101,10 +111,8 @@
android:textColor="@color/bus_autopilot_text_color_selector"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:textStyle="bold"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
app:layout_constraintLeft_toLeftOf="parent" />
<RelativeLayout
android:id="@+id/module_mogo_och_setting_layout"
@@ -116,21 +124,23 @@
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
<ImageView
android:id="@+id/module_och_bus_upgrade_red_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:visibility="gone"
android:background="@drawable/bus_setting_tip_red_cir_bg"
android:elevation="8px"
android:background="@drawable/bus_setting_tip_red_cir_bg" />
android:visibility="gone" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/bus_setting_btn_bg" />
</RelativeLayout>
@@ -140,11 +150,11 @@
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:src="@drawable/bus_badcase_btn_bg"
android:elevation="@dimen/dp_10"
android:src="@drawable/bus_badcase_btn_bg"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout"/>
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout" />
<com.mogo.och.bus.view.SlidePanelView
android:id="@+id/module_mogo_och_slide_panel"
@@ -203,6 +213,7 @@
android:textSize="30sp"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<Button
android:id="@+id/btnAutopilotRoute"
android:layout_width="wrap_content"
@@ -222,13 +233,13 @@
,btnAutopilotRunning,btnAutopilotRoute"
tools:visibility="visible" />
<!-- <com.mogo.och.bus.ui.BusTrafficLightView-->
<!-- android:id="@+id/bus_traffic_light_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:layout_marginRight="@dimen/bus_traffic_light_layout_margin_right"-->
<!-- android:layout_marginTop="@dimen/bus_traffic_light_layout_margin_top"-->
<!-- android:visibility="gone"/>-->
<!-- <com.mogo.och.bus.ui.BusTrafficLightView-->
<!-- android:id="@+id/bus_traffic_light_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:layout_marginRight="@dimen/bus_traffic_light_layout_margin_right"-->
<!-- android:layout_marginTop="@dimen/bus_traffic_light_layout_margin_top"-->
<!-- android:visibility="gone"/>-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -104,9 +104,9 @@
<dimen name="bus_ext_arcView_stroke_with">20px</dimen>
<dimen name="bus_ext_arcView_top">40px</dimen>
<dimen name="bus_ext_arcView_width">320px</dimen>
<dimen name="bus_ext_speed_height">460px</dimen>
<dimen name="bus_ext_speed_height">320px</dimen>
<dimen name="bus_ext_speed_padding">70px</dimen>
<dimen name="bus_ext_speed_width">460px</dimen>
<dimen name="bus_ext_speed_width">616px</dimen>
<dimen name="bus_ext_speed_width_big_radius">130px</dimen>
<dimen name="bus_ext_speed_width_sm_radius">30px</dimen>
<dimen name="bus_switch_map">279px</dimen>

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("192.168.1.")
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">#FF343C63</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">#FF343C63</color>
</resources>

View File

@@ -1,12 +1,7 @@
package com.mogo.eagle.core.function.smp;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.location.Location;
import android.os.Bundle;
import android.util.AttributeSet;
@@ -18,18 +13,14 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.amap.api.maps.model.Polyline;
import com.amap.api.maps.model.PolylineOptions;
import com.amap.api.navi.AMapNavi;
import com.amap.api.navi.AMapNaviListener;
import com.amap.api.navi.AMapNaviView;
@@ -52,23 +43,21 @@ import com.amap.api.navi.model.NaviInfo;
import com.amap.api.navi.model.NaviLatLng;
import com.amap.api.navi.model.RouteOverlayOptions;
import com.autonavi.tbt.TrafficFacilityInfo;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.common.utils.DrivingDirectionUtils;
import com.zhidao.support.adas.high.AdasManager;
import org.jetbrains.annotations.NotNull;
@@ -76,6 +65,9 @@ import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* 小地图的方向View
@@ -86,14 +78,16 @@ import mogo.telematics.pad.MessagePad;
*/
public class AMapCustomView
extends RelativeLayout
implements IMoGoMapLocationListener, ISmallMapDirectionView, AMapNaviListener, AMapNaviViewListener, IMoGoAutopilotPlanningListener {
implements IMoGoMapLocationListener, ISmallMapDirectionView, AMapNaviListener, AMapNaviViewListener {
public static final String TAG = "SmallMapDirectionView";
private AMapNaviView mAMapNaviView;
protected AMapNavi mAMapNavi;
private AMap mAMap;
protected NaviLatLng mStartLatlng = new NaviLatLng();
protected NaviLatLng mEndLatlng = new NaviLatLng();
//328路线测试数据
protected NaviLatLng mStartLatlng = new NaviLatLng(39.969111, 116.411903);
protected NaviLatLng mEndLatlng = new NaviLatLng(40.037209, 116.314358);
// protected NaviLatLng mStartLatlng = new NaviLatLng(39.969111, 116.411903);
// protected NaviLatLng mEndLatlng = new NaviLatLng(40.037209, 116.314358);
//顺义国展测试数据
// mStartLatlng = new NaviLatLng(40.09383,116.51899);
// mEndLatlng = new NaviLatLng(40.09964,116.54570);
@@ -108,6 +102,7 @@ public class AMapCustomView
private Context mContext;
private float tilt = 40f;
private TextView overLayerView;
private boolean calculate = false;
public AMapCustomView(Context context) {
this(context, null);
@@ -128,19 +123,18 @@ public class AMapCustomView
private void initView(Context context) {
mContext = context;
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));
Log.d(TAG, "initView:" + mWayPointList.toString());
//顺义国展路线
// mWayPointList.add(new NaviLatLng(40.097621,116.526495));
@@ -156,6 +150,8 @@ public class AMapCustomView
mAMapNavi = AMapNavi.getInstance(context);
mAMapNavi.addAMapNaviListener(this);
mAMapNaviView.setAMapNaviViewListener(this);
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
initAMapView(context);
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
@@ -165,11 +161,113 @@ public class AMapCustomView
});
}
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @org.jetbrains.annotations.Nullable String reason) {
}
@Override
public void onAutopilotGuardian(@org.jetbrains.annotations.Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotArriveAtStation(@org.jetbrains.annotations.Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (autoPilotStatusInfo == null) return;
int state = autoPilotStatusInfo.getState();
//0 不能自动驾驶 1 可以自动驾驶,但是在人工干预 2 自动驾驶中
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
Log.d(TAG, "自动驾驶中= %s" + String.valueOf(state));
if (sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
Log.d(TAG, "sendGlobalPathReq");
AdasManager.getInstance().sendGlobalPathReq();
}
} else {
int type = mAMapNavi.getNaviType();
Log.d(TAG, "非自动驾驶状态,导航类型==" + String.valueOf(type));
if (type == NaviType.GPS || type == NaviType.EMULATOR) {
mAMapNavi.stopNavi();
}
}
}
});
}
};
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
@Override
public void onAutopilotTrajectory(@NotNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {
Log.d(TAG, "onAutopilotTrajectory");
}
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
@Override
public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) {
if (calculate == true) {
return;
}
calculate = true;
Log.d(TAG, "onAutopilotRotting");
List list = globalPathResp.getWayPointsList();
int minCount = 2;
if (list.size() >= minCount && sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
calculate = true;
MessagePad.Location sLocation = (MessagePad.Location) list.get(0);
MessagePad.Location eLocation = (MessagePad.Location) list.get(list.size() - 1);
mStartLatlng = new NaviLatLng(sLocation.getLatitude(), sLocation.getLongitude());
mEndLatlng = new NaviLatLng(eLocation.getLatitude(), eLocation.getLongitude());
sList.clear();
eList.clear();
sList.add(mStartLatlng);
eList.add(mEndLatlng);
mWayPointList.clear();
for (int i = 1; i < list.size() - minCount; i++) {
MessagePad.Location wayLoc = (MessagePad.Location) list.get(i);
NaviLatLng way = new NaviLatLng(wayLoc.getLatitude(), wayLoc.getLongitude());
mWayPointList.add(way);
}
}
int strategy = 0;
try {
//再次强调最后一个参数为true时代表多路径否则代表单路径
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
} catch (Exception e) {
e.printStackTrace();
}
Log.d(TAG, "全局路径" + list.size() + ",起点:" + sList.toString() + ",终点:" + eList.toString() + ",经点:" + mWayPointList.toString());
//指定路径绘制导航路线
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
}
};
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
}
private void initAMapView(Context context) {
@@ -349,6 +447,7 @@ public class AMapCustomView
@Override
public void onInitNaviFailure() {
calculate = false;
Log.d(TAG, "onInitNaviFailure");
}
@@ -371,7 +470,7 @@ public class AMapCustomView
@Override
public void onLocationChange(AMapNaviLocation aMapNaviLocation) {
Log.d(TAG, "高德地图经纬度:" + aMapNaviLocation.getCoord().getLongitude() + "," + aMapNaviLocation.getCoord().getLatitude());
// Log.d(TAG, "高德地图经纬度:" + aMapNaviLocation.getCoord().getLongitude() + "," + aMapNaviLocation.getCoord().getLatitude());
}
@@ -595,42 +694,4 @@ public class AMapCustomView
}
@Override
public void onAutopilotTrajectory(@NotNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {
}
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
@Override
public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) {
List list = globalPathResp.getWayPointsList();
int minCount = 2;
if (list.size() >= minCount) {
Location sLocation = (Location) list.get(0);
Location eLocation = (Location) list.get(list.size() - 1);
mStartLatlng = new NaviLatLng(sLocation.getLongitude(), sLocation.getLatitude());
mEndLatlng = new NaviLatLng(eLocation.getLongitude(), eLocation.getLatitude());
sList.add(mStartLatlng);
eList.add(mEndLatlng);
for (int i = 1; i < list.size() - minCount; i++) {
Location wayLoc = (Location) list.get(i);
NaviLatLng way = new NaviLatLng(wayLoc.getLongitude(), wayLoc.getLatitude());
mWayPointList.add(way);
}
}
int strategy = 0;
try {
//再次强调最后一个参数为true时代表多路径否则代表单路径
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
} catch (Exception e) {
e.printStackTrace();
}
Log.d(TAG, "calculateDriveRoute ADAS全局路径坐标:" + list.size() + "," + sList.toString() + "," + eList.toString() + "," + mWayPointList.toString());
//指定路径绘制导航路线
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
}
}

View File

@@ -3,8 +3,13 @@
<dimen name="dp_12">12px</dimen>
<dimen name="dp_20">20px</dimen>
<dimen name="dp_22">22px</dimen>
<dimen name="dp_43">43px</dimen>
<dimen name="dp_57">57px</dimen>
<dimen name="dp_72">72px</dimen>
<dimen name="dp_88">88px</dimen>
<dimen name="module_v2n_tip_text_margin_right">26px</dimen>
<dimen name="warning_distance_right">30px</dimen>
<dimen name="dp_270">270px</dimen>
<dimen name="dp_320">320px</dimen>
<dimen name="dp_630">630px</dimen>
</resources>