fix bug
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.mogo.module.adas.entity.AdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
@@ -11,10 +13,6 @@ import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilotLocReceiverBean>
|
||||
, IAdasDataListener
|
||||
@@ -23,7 +21,7 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
|
||||
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 static final int MSG_SOCKET_TYPE = 501000;
|
||||
|
||||
private DispatchRemindDialog dispatchRemindDialog;
|
||||
|
||||
@@ -81,16 +79,16 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM);
|
||||
// AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(boolean manualTrigger) {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(manualTrigger ?
|
||||
DISPATCH_RESULT_MANUAL_CANCEL : DISPATCH_RESULT_TIMER_CANCEL);
|
||||
// AdasServiceModel.getInstance().dispatchResultUpload(manualTrigger ?
|
||||
// DISPATCH_RESULT_MANUAL_CANCEL : DISPATCH_RESULT_TIMER_CANCEL);
|
||||
}
|
||||
|
||||
public void test(){
|
||||
public void test() {
|
||||
dispatchRemindDialog.showDialog("123123123");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,17 @@ public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
private final TextView tvTimer;
|
||||
private final TextView tvLoc;
|
||||
private final Button tvAffirm;
|
||||
private final Button tvCancel;
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_TIMER) {
|
||||
if (TIMER >= 0) {
|
||||
if (TIMER > 0) {
|
||||
TIMER--;
|
||||
Logger.d(TAG,"timer : " + TIMER);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER,1000L);
|
||||
} else {
|
||||
hideDialog();
|
||||
}
|
||||
@@ -46,17 +45,19 @@ public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
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 = (Button)findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
tvCancel = (Button)findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
Button btnCancel = (Button) findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
tvAffirm.setOnClickListener(v -> {
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
btnCancel.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(true);
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -67,12 +68,16 @@ public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
tvLoc.setText(locContent);
|
||||
}
|
||||
|
||||
public void hideDialog() {
|
||||
private void hideDialog() {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(false);
|
||||
}
|
||||
mListener = null;
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
private void dismissDialog(){
|
||||
handler.removeMessages(MSG_TYPE_TIMER);
|
||||
TIMER = 10;
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomLeftRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomRightRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -3,7 +3,7 @@
|
||||
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"
|
||||
android:background="@color/adas_dispatch_remind_background">
|
||||
android:background="@drawable/module_adas_bg_shape">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_timer"
|
||||
@@ -45,9 +45,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_loc_margin_top"
|
||||
android:maxLines="1"
|
||||
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"
|
||||
@@ -66,6 +66,7 @@
|
||||
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:background="@drawable/module_adas_left_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_affirm"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
@@ -84,9 +85,10 @@
|
||||
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:background="@drawable/module_adas_right_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_cancel"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/adas_dispatch_remind_cancel"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<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>
|
||||
<color name="adas_dispatch_remind_cancel">#AFB3C7</color>
|
||||
|
||||
</resources>
|
||||
@@ -62,6 +62,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
protected static final String TAG = "MainActivity";
|
||||
private static final int REQUEST_CODE_DIALOG = 100;
|
||||
|
||||
protected IMogoServiceApis mServiceApis;
|
||||
protected IMogoFragmentManager mMogoFragmentManager;
|
||||
@@ -112,7 +113,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
|
||||
mApps = findViewById(R.id.module_main_id_apps_fragment_container);
|
||||
@@ -140,6 +140,9 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
|
||||
}
|
||||
//申请悬浮窗权限
|
||||
Intent intent=new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||
startActivityForResult(intent, REQUEST_CODE_DIALOG);
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
@@ -486,4 +489,9 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user