[dev_robotaxi-d_230412_2.15.0]同步云调度功能
This commit is contained in:
@@ -221,6 +221,14 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
}
|
||||
}
|
||||
|
||||
override fun showDispatchRestartDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
context?.let{
|
||||
DispatchDialogManager.getInstance(it).showRestartDialog(msgData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoticeForTrafficWithData(pushData: NoticeTrafficStylePushData?) {
|
||||
pushData?.let {
|
||||
ThreadUtils.runOnUiThread {
|
||||
|
||||
@@ -3,17 +3,21 @@ package com.mogo.eagle.core.function.hmi.ui.notice;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
public abstract class DispatchBaseDialog extends Dialog {
|
||||
|
||||
public DispatchBaseDialog(@NonNull Context context) {
|
||||
super(context, R.style.Base_AlertDialog_AppCompat);
|
||||
super(context,R.style.BaseFloatDialogStyle);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
||||
} else {
|
||||
@@ -26,4 +30,22 @@ public abstract class DispatchBaseDialog extends Dialog {
|
||||
|
||||
public abstract void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent);
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
setWindowSize();
|
||||
}
|
||||
private void setWindowSize(){
|
||||
WindowManager.LayoutParams attributes = getWindow().getAttributes();
|
||||
attributes.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
attributes.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
FrameLayout content = (FrameLayout)findViewById(android.R.id.content);
|
||||
if(content!=null){
|
||||
ViewGroup rootView = (ViewGroup) content.getChildAt(0);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) rootView.getLayoutParams();
|
||||
layoutParams.gravity = Gravity.CENTER;
|
||||
rootView.setLayoutParams(layoutParams);
|
||||
}
|
||||
getWindow().setAttributes(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ public class DispatchCarsDialog extends DispatchBaseDialog {
|
||||
|
||||
private final TextView tvTimer;
|
||||
private final TextView tvLoc;
|
||||
private final TextView tvAdasDispatchTitle;
|
||||
private final TextView tvAdasDispatchRemindContent;
|
||||
|
||||
private int dispatchType = 1;//调度类型:1:启动 2:停止
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
@@ -44,21 +48,40 @@ public class DispatchCarsDialog extends DispatchBaseDialog {
|
||||
setCanceledOnTouchOutside(false);
|
||||
tvTimer = findViewById(R.id.module_adas_dispatch_remind_timer);
|
||||
tvLoc = findViewById(R.id.module_adas_dispatch_remind_loc);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
Button btnCancel = (Button) findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvAdasDispatchTitle = findViewById(R.id.tv_adas_dispatch_title);
|
||||
tvAdasDispatchRemindContent = findViewById(R.id.tv_adas_dispatch_remind_content);
|
||||
Button btnAffirm = findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
Button btnCancel = findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
CallerFuncBizManager.getBizProvider().dispatchAffirm();
|
||||
if(dispatchType == 1){
|
||||
//开始调度确认
|
||||
CallerFuncBizManager.getBizProvider().dispatchAffirm();
|
||||
}else if(dispatchType == 2){
|
||||
//停止调度确认
|
||||
CallerFuncBizManager.getBizProvider().stopDispatchAffirm();
|
||||
}
|
||||
dismissDialog();
|
||||
});
|
||||
btnCancel.setOnClickListener(v -> {
|
||||
CallerFuncBizManager.getBizProvider().dispatchCancel(true);
|
||||
if(dispatchType == 1){
|
||||
//开始调度手动取消
|
||||
CallerFuncBizManager.getBizProvider().dispatchCancel(true);
|
||||
}else if(dispatchType == 2){
|
||||
//停止调度手动取消
|
||||
CallerFuncBizManager.getBizProvider().stopDispatchCancel(true);
|
||||
}
|
||||
dismissDialog();
|
||||
});
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
CallerFuncBizManager.getBizProvider().dispatchCancel(false);
|
||||
if(dispatchType == 1){
|
||||
//开始调度自动取消
|
||||
CallerFuncBizManager.getBizProvider().dispatchCancel(false);
|
||||
}else if(dispatchType == 2){
|
||||
CallerFuncBizManager.getBizProvider().stopDispatchCancel(false);
|
||||
}
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@@ -74,6 +97,12 @@ public class DispatchCarsDialog extends DispatchBaseDialog {
|
||||
return;
|
||||
}
|
||||
show();
|
||||
if(dispatchContent.getType() == 2){
|
||||
//取消调度
|
||||
tvAdasDispatchTitle.setText("调度取消确认");
|
||||
tvAdasDispatchRemindContent.setText("车辆将取消到以下位置的自动驾驶");
|
||||
}
|
||||
dispatchType = dispatchContent.getType();
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
tvLoc.setText(dispatchContent.getEndLocAddress());
|
||||
}
|
||||
|
||||
@@ -53,16 +53,38 @@ public class DispatchDialogManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchHengYang(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
if (msgData.getType() == DISPATCH_TYPE_START) { //衡阳只有开始调度
|
||||
if (dialog != null && dialog.isShowing()) { //避免下发两次
|
||||
return;
|
||||
}
|
||||
if (dialog == null) {
|
||||
dialog = new DispatchCarsDialog(mContext);
|
||||
}
|
||||
dialog.showDialog(msgData);
|
||||
/**
|
||||
* 云调度重启自驾
|
||||
* @param msgData 长链下发实体
|
||||
*/
|
||||
public void showRestartDialog(DispatchAdasAutoPilotLocReceiverBean msgData){
|
||||
if(isShowing()){
|
||||
return;
|
||||
}
|
||||
if (msgData == null) {
|
||||
return;
|
||||
}
|
||||
if (dialog != null && dialog.isShowing()) { //避免下发两次
|
||||
return;
|
||||
}
|
||||
if(dialog == null){
|
||||
dialog = new DispatchRestartDialog(mContext);
|
||||
}
|
||||
dialog.showDialog(msgData);
|
||||
}
|
||||
|
||||
private void dispatchHengYang(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
// if (msgData.getType() == DISPATCH_TYPE_START) { //衡阳只有开始调度
|
||||
// }
|
||||
//开始、取消调度
|
||||
if (dialog != null && dialog.isShowing()) { //避免下发两次
|
||||
return;
|
||||
}
|
||||
if (dialog == null) {
|
||||
dialog = new DispatchCarsDialog(mContext);
|
||||
}
|
||||
dialog.showDialog(msgData);
|
||||
|
||||
}
|
||||
|
||||
private void dispatchEZhou(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
public class DispatchRestartDialog extends DispatchBaseDialog{
|
||||
|
||||
public DispatchRestartDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.dialog_adas_dispatch_restart);
|
||||
setCanceledOnTouchOutside(false);
|
||||
TextView dispatchRestartEnter = findViewById(R.id.tv_dispatch_restart_enter);
|
||||
dispatchRestartEnter.setOnClickListener(v -> {
|
||||
//启动自动驾驶
|
||||
CallerFuncBizManager.getBizProvider().restartDispatchAffirm();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adas_dispatch_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_cars_dialog_title_margin_top"
|
||||
@@ -30,6 +31,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adas_dispatch_remind_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_cars_dialog_content_margin_top"
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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/module_services_dispatch_cars_dialog_width"
|
||||
android:layout_height="@dimen/module_services_dispatch_cars_dialog_height"
|
||||
android:background="@drawable/bg_dispatch_cars">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="@string/dispatch_dialog_restart_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_48"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_cars_dialog_title_margin_top"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_200"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/dispatch_dialog_restart_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dispatch_restart_enter"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/module_services_dispatch_cars_dialog_line_margin_bottom"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="@string/dispatch_dialog_restart_enter"
|
||||
android:textColor="@color/color_1F9BFE"
|
||||
android:textSize="@dimen/module_services_dispatch_cars_dialog_title_size"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/color_66B8BFE8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_dispatch_restart_enter"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -64,6 +64,9 @@
|
||||
<string name="dispatch_dialog_flight_info">航班信息:</string>
|
||||
<string name="dispatch_dialog_affirm">接受任务</string>
|
||||
<string name="dispatch_cars_remind_title">调度确认</string>
|
||||
<string name="dispatch_dialog_restart_title">提示</string>
|
||||
<string name="dispatch_dialog_restart_content">当前车辆已退出自动驾驶,请点击下方按钮恢复</string>
|
||||
<string name="dispatch_dialog_restart_enter">进入自动驾驶</string>
|
||||
<string name="dispatch_cars_remind_content">车辆将开启自动驾驶,并行驶至:</string>
|
||||
<string name="dispatch_cars_affirm">确认</string>
|
||||
<string name="dispatch_cars_cancel">取消</string>
|
||||
|
||||
Reference in New Issue
Block a user