add dispatch remind dialog and UI changes
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -3,15 +3,21 @@ package com.mogo.module.adas;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.adas.entity.AdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.adas.view.DispatchRemindDialog;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilotLocReceiverBean> {
|
||||
//todo 自动驾驶车辆状态上报,路线上报,监听自动驾驶状态,结束置空 autoPilotLocReceiverBean
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilotLocReceiverBean>, DispatchRemindDialog.IDispatchRemindClickListener {
|
||||
|
||||
private static final String TAG = "AdasAutoPilotManager";
|
||||
private static volatile AdasAutoPilotManager instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private static final int MSG_SOCKET_TYPE = 1;
|
||||
private Context mContext;
|
||||
private DispatchRemindDialog dispatchRemindDialog;
|
||||
private AdasAutoPilotLocReceiverBean autoPilotLocReceiverBean;
|
||||
|
||||
private AdasAutoPilotManager() {
|
||||
|
||||
@@ -33,6 +39,8 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
dispatchRemindDialog = new DispatchRemindDialog(context);
|
||||
dispatchRemindDialog.addIDispatchRemindListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,7 +53,24 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getLon() != 0.0) {
|
||||
|
||||
if (this.autoPilotLocReceiverBean != null) {
|
||||
Logger.d(TAG, "onMsgReceived 上次下发调度还未确认完");
|
||||
return;
|
||||
}
|
||||
this.autoPilotLocReceiverBean = adasAutoPilotLocReceiverBean;
|
||||
dispatchRemindDialog.show(adasAutoPilotLocReceiverBean.getPoiAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
//todo 网络请求
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
//todo 网络请求
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,88 @@
|
||||
package com.mogo.module.adas.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.adas.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "DispatchRemindDialog";
|
||||
private static final int MSG_TYPE_TIMER = 0;
|
||||
private static int TIMER = 10;
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private TextView tvTimer;
|
||||
private TextView tvLoc;
|
||||
private TextView tvAffirm;
|
||||
private TextView tvCancel;
|
||||
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_TIMER) {
|
||||
if (TIMER >= 0) {
|
||||
TIMER--;
|
||||
tvTimer.setText(TIMER);
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public DispatchRemindDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.dialog_adas_dispatch_remind);
|
||||
tvTimer = findViewById(R.id.module_adas_dispatch_remind_timer);
|
||||
tvLoc = findViewById(R.id.module_adas_dispatch_remind_loc);
|
||||
tvAffirm = findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
tvCancel = findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvTimer.setText(TIMER);
|
||||
tvAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
}
|
||||
});
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void show(String locContent) {
|
||||
show();
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
tvLoc.setText(locContent);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
dismiss();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener has listener");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public interface IDispatchRemindClickListener {
|
||||
|
||||
void affirm();
|
||||
|
||||
void cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="@color/adas_dispatch_remind_count_down_bg"/>
|
||||
</shape>
|
||||
@@ -1,13 +1,93 @@
|
||||
<?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/adas_dispatch_remind_dialog_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:background="@color/adas_dispatch_remind_background">
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/module_adas_dispatch_remind_timer"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_margin="@dimen/adas_dispatch_remind_dialog_timer_margin"
|
||||
android:background="@drawable/module_adas_timer_bg_shape"
|
||||
android:gravity="center"
|
||||
android:text="10"
|
||||
android:textColor="@color/adas_dispatch_remind_count_down_txt"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_timer_txt_size"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_title_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_content_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_content_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_loc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_loc_margin_top"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_loc_size"
|
||||
android:maxLines="1"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@color/adas_dispatch_remind_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_affirm"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_affirm"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="1px"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:layout_marginStart="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_cancel"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_cancel"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,4 +3,15 @@
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
</resources>
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="adas_dispatch_remind_loc">#1F9BFE</color>
|
||||
<color name="adas_dispatch_remind_text_loc">#1F9BFE</color>
|
||||
<color name="adas_dispatch_remind_background">#E63B4577</color>
|
||||
<color name="adas_dispatch_remind_count_down_txt">#8E9DD4</color>
|
||||
<color name="adas_dispatch_remind_count_down_bg">#4D000000</color>
|
||||
<color name="adas_dispatch_remind_line">#66B8BFE8</color>
|
||||
|
||||
</resources>
|
||||
@@ -3,4 +3,15 @@
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
</resources>
|
||||
7
modules/mogo-module-adas/src/main/res/values/strings.xml
Normal file
7
modules/mogo-module-adas/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_adas_dispatch_remind_title">调度确认</string>
|
||||
<string name="module_adas_dispatch_remind_content">车辆将开启自动驾驶,并行驶至:</string>
|
||||
<string name="module_adas_dispatch_remind_affirm">确认</string>
|
||||
<string name="module_adas_dispatch_remind_cancel">取消</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user