完成了自动驾驶按钮的点击触发逻辑抽离

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-23 10:57:34 +08:00
committed by liujing
parent 36844ee704
commit 65640589fd
15 changed files with 210 additions and 186 deletions

View File

@@ -8,6 +8,7 @@
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
</codeStyleSettings>
<codeStyleSettings language="XML">

View File

@@ -54,12 +54,13 @@ dependencies {
if (Boolean.valueOf(RELEASE)) {
} else {
api project(':services:mogo-service-api')
implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
}
}

View File

@@ -1,12 +1,16 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.content.res.TypedArray
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AdasOCHData
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.adas.IMogoAdasOCHCallback
import kotlinx.android.synthetic.main.view_autopilot_status.view.*
/**
@@ -17,20 +21,13 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.*
class AutoPilotStatusView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet
) : ConstraintLayout(context, attrs) {
) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
private val TAG = "AutopilotStatusView"
private var mAutopilotStatus: Int = 0
init {
val typedArray: TypedArray =
context.obtainStyledAttributes(attrs, R.styleable.AutopilotStatusView)
mAutopilotStatus = typedArray.getInt(R.styleable.AutopilotStatusView_autopilotStatus, 0)
typedArray.recycle()
LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
initView(context)
}
@@ -40,16 +37,38 @@ class AutoPilotStatusView @JvmOverloads constructor(
val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
layoutParams = lp
// 设置点击监听
setOnClickListener(this)
// 首次查询自动驾驶状态
mAutopilotStatus = MogoApisHandler.getInstance().apis.adasControllerApi.autopilotStatus
// 自动驾驶状态监听
MogoApisHandler.getInstance().apis.adasControllerApi.addAdasOCHCallback(this)
LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
setAutoPilotStatus(mAutopilotStatus)
}
override fun onClick(v: View?) {
when (mAutopilotStatus) {
0 -> {// 不可自动驾驶adas与工控机没有链接或工控机异常
LogUtils.eTag(TAG, "不可自动驾驶adas与工控机没有链接或工控机异常,请检查链路")
}
1 -> {// 可自动驾驶,目前处于人工干预状态
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
}
2 -> {// 自动驾驶中
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
}
}
}
/**
* 设置自动驾驶状态
* 0-// 不可自动驾驶adas与工控机没有链接或工控机异常
* 1-// 可自动驾驶,目前处于人工干预状态
* 2-// 自动驾驶中
*/
fun setAutoPilotStatus(autopilotStatus: Int) {
private fun setAutoPilotStatus(autopilotStatus: Int) {
mAutopilotStatus = autopilotStatus
when (autopilotStatus) {
0 -> {// 不可自动驾驶adas与工控机没有链接或工控机异常
@@ -67,4 +86,13 @@ class AutoPilotStatusView @JvmOverloads constructor(
}
}
override fun onArriveAt(data: AdasOCHData?) {
}
override fun onStateChanged(state: Int, reason: String?) {
setAutoPilotStatus(state)
}
}

View File

@@ -33,7 +33,6 @@
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/flSpeedChartView"
app:layout_constraintTop_toBottomOf="@+id/flSpeedChartView"
tools:autopilotStatus="running"
tools:visibility="visible" />
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficLightView

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.hmi.autopilot
/**
* @author xiaoyuzhou
* @date 2021/9/22 9:26 下午
* 自动驾驶控制按钮回调监听
*/
interface IMoGoCheckAutoPilotBtnListener {
fun onCheck(isChecked: Boolean)
}

View File

@@ -0,0 +1,56 @@
package com.mogo.eagle.core.function.call.hmi
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.LogUtils
/**
* @author xiaoyuzhou
* @date 2021/9/23 10:22 上午
* HMI 视图上的监听管理
*/
object CallerHmiListenerManager : CallerBase() {
private val TAG = "CallerHmiListenerManager"
private val checkAutoPilotBtnListeners: HashMap<String, IMoGoCheckAutoPilotBtnListener> =
HashMap()
/**
* 添加自动驾驶按钮选中监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addCheckAutoPilotBtnListener(
@Nullable tag: String,
@Nullable listener: IMoGoCheckAutoPilotBtnListener
) {
checkAutoPilotBtnListeners[tag] = listener
}
/**
* 删除自动驾驶按钮选中监听
* @param tag 标记,用来注销监听使用
*/
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
checkAutoPilotBtnListeners.remove(tag)
}
/**
* 触发自动驾驶按钮选中监听
* @param isChecked 选中状态
*/
fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
LogUtils.dTag(TAG, "isChecked:$isChecked")
checkAutoPilotBtnListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onCheck(isChecked)
}
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.hmi
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase

View File

@@ -12,11 +12,5 @@
<attr name="civ_fill_color" format="color" />
</declare-styleable>
<declare-styleable name="AutopilotStatusView">
<attr name="autopilotStatus">
<enum name="disable" value="0" />
<enum name="enable" value="1" />
<enum name="running" value="2" />
</attr>
</declare-styleable>
</resources>

View File

@@ -1,5 +1,20 @@
package com.mogo.module.extensions.entrance;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
import static com.mogo.module.service.receiver.MogoReceiver.ACTION_V2X_REMOVE_TIP_WINDOW;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
import android.content.Intent;
import android.graphics.Rect;
import android.location.Location;
@@ -71,8 +86,6 @@ import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.entrance.ButtonIndex;
@@ -100,21 +113,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Random;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
import static com.mogo.module.service.receiver.MogoReceiver.ACTION_V2X_REMOVE_TIP_WINDOW;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
/**
* @author congtaowang
* @since 2020-01-07
@@ -128,9 +126,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
IMogoAimlessModeListener,
IMogoStatusChangedListener,
IMogoIntentListener,
// IMogoLocationListener,
IMogoCheckListener ,
IMogoAdasOCHCallback,
// IMogoLocationListener,
IMogoCheckListener,
IMogoCarLocationChangedListener2 {
private static final String TAG = "EntranceFragment";
@@ -214,7 +211,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private TextView tvRed;
private TextView tvGreen;
// private CheckedTextView ctvAutopilotStatus;
// private CheckedTextView ctvAutopilotStatus;
/**
* 内部变量标识是否在vrMode用于方法执行过滤避免重复或异常调用
@@ -284,7 +281,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
groupFix = findViewById(R.id.groupFix);
// ctvAutopilotStatus = findViewById(R.id.module_mogo_autopilot_status);
// ctvAutopilotStatus = findViewById(R.id.module_mogo_autopilot_status);
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
@@ -355,16 +352,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
});
}
// onAutopilotStatusChanged(
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
// ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
// @Override
// public void onClickImpl(View v) {
// // 如果能自动驾驶,就自动驾驶,不能就提示
// autopilotStatusClick();
// }
// });
// ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
// @Override
// public void onClickImpl(View v) {
// // 如果能自动驾驶,就自动驾驶,不能就提示
// autopilotStatusClick();
// }
// });
dealWeatherContainer();
@@ -399,7 +394,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
enterVrMode();
localIsVrMode = true;
}
// //检测入口
// //检测入口
jumpCheck = findViewById(R.id.module_ext_enter_check);
tipImageView = findViewById(R.id.error_tip_image);
jumpCheck.setOnClickListener(new View.OnClickListener() {
@@ -413,21 +408,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
// /**
// * 自动驾驶状态改变
// *
// * @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中
// */
// public void onAutopilotStatusChanged(boolean isInAutopilot) {
// getActivity().runOnUiThread(() -> {
// ctvAutopilotStatus.setChecked(isInAutopilot);
// });
// }
private void autopilotStatusClick() {
EntranceViewHolder.getInstance().entranceAutopilotStatusClick();
}
private int debugPanelClickCount = 0;
private long lastDebugPanelClickTime = 0;
@@ -442,8 +422,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMsgContainer.setVisibility(View.GONE);
groupUserHead.setVisibility(View.GONE);
groupUserHead.setVisibility(View.GONE);
// ctvAutopilotStatus.setVisibility(View.VISIBLE);
// tvExitVrMode.setVisibility(View.VISIBLE);
// tvExitVrMode.setVisibility(View.VISIBLE);
TopViewAnimHelper.getInstance().enterVrMode();
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
mNaviInfo = vrModeNavInfoView;
@@ -585,7 +564,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (intervalTime == 0) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
// AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[random.nextInt(3)]);
// AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[random.nextInt(3)]);
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[0]);
} else {
Logger.d(TAG, " playShareOuterGuideVoice else interval = " + (time - intervalTime));
@@ -744,7 +723,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
//车辆监控
//车辆监控
CallerCheckManager.registerVehicleMonitoringListener(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, this);
mMogoMarkerManager = mService.getMarkerManager(getContext());
@@ -884,15 +863,15 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
} else {
mExitNavi.setText(R.string.module_ext_str_continue_navi);
}
// if ( isLock ) {
// if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.module_map_ic_move2_current_location );
// }
// if ( isLock ) {
// if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.module_map_ic_move2_current_location );
// }
}
private void traceData(String from) {
@@ -1007,14 +986,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private void debugTopView() {
findViewById(R.id.btnDebugCtrlNaviView).setOnClickListener(view -> {
// SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705236512" +
// "&di=50620661ded7035fb84899a408f9f27e&imgtype=0&src=http%3A%2F%2Fb-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F201409%2F11%2F20140911211243_3rT4u.jpeg");
// MyLocationUtil.setMyLocationIconUrl(getContext(), "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705236512" +
// "&di=50620661ded7035fb84899a408f9f27e&imgtype=0&src=http%3A%2F%2Fb-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F201409%2F11%2F20140911211243_3rT4u.jpeg");
// SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705236512" +
// "&di=50620661ded7035fb84899a408f9f27e&imgtype=0&src=http%3A%2F%2Fb-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F201409%2F11%2F20140911211243_3rT4u.jpeg");
// MyLocationUtil.setMyLocationIconUrl(getContext(), "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705236512" +
// "&di=50620661ded7035fb84899a408f9f27e&imgtype=0&src=http%3A%2F%2Fb-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F201409%2F11%2F20140911211243_3rT4u.jpeg");
if (!toggle) {
TopViewAnimHelper.getInstance().showNaviView();
} else {
@@ -1024,7 +1003,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
});
findViewById(R.id.btnDebugCtrlSubView).setOnClickListener(view -> {
// MyLocationUtil.emphasizeMyLocation();
// MyLocationUtil.emphasizeMyLocation();
View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
TextView tv = v.findViewById(R.id.tvIndex);
tv.setText("sub view height: " + currentHeight + ": " + v);
@@ -1052,17 +1031,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
});
findViewById(R.id.btnDebugCtrlTopView).setOnClickListener(view -> {
// SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
// ".1000_0.jpeg");
// MyLocationUtil.setMyLocationIconUrl(getContext(),"https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
// ".1000_0.jpeg");
// MyLocationUtil.emphasizeMyLocation();
// SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
// ".1000_0.jpeg");
// MyLocationUtil.setMyLocationIconUrl(getContext(),"https" +
// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
// ".1000_0.jpeg");
// MyLocationUtil.emphasizeMyLocation();
View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
TextView tv = v.findViewById(R.id.tvIndex);
Random random = new Random();
@@ -1070,7 +1049,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tv.setText(" height: " + currentHeight + ": " + v);
ViewGroup.LayoutParams params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight);
// mApis.getEntranceButtonController().addLeftFeatureView(v);
// mApis.getEntranceButtonController().addLeftFeatureView(v);
mApis.getTopViewManager().addView(v, params, new IMogoTopViewStatusListener() {
@Override
@@ -1113,12 +1092,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMsgContainer.setVisibility(View.GONE);
// String enthusiasmIndex = "一般的字加粗的字一般的字";
// SpannableString spannableStringUnSelectCountStr = new SpannableString(enthusiasmIndex);
// ForegroundColorSpan foregroundColorSpanUnSelectCount = new ForegroundColorSpan(Color.RED);
// spannableStringUnSelectCountStr.setSpan(foregroundColorSpanUnSelectCount, 4, 7, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
//
// TipToast.tip(spannableStringUnSelectCountStr.toString());
// String enthusiasmIndex = "一般的字加粗的字一般的字";
// SpannableString spannableStringUnSelectCountStr = new SpannableString(enthusiasmIndex);
// ForegroundColorSpan foregroundColorSpanUnSelectCount = new ForegroundColorSpan(Color.RED);
// spannableStringUnSelectCountStr.setSpan(foregroundColorSpanUnSelectCount, 4, 7, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
//
// TipToast.tip(spannableStringUnSelectCountStr.toString());
TipDrawable drawable =
new TipDrawable(getResources().getDrawable(R.drawable.model_ext_default_user_head));
TipToast.tip("分享成功", drawable);
@@ -1135,11 +1114,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
// if ( ui == EnumMapUI.CarUp_2D ) {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
// } else if( ui == EnumMapUI.NorthUP_2D ){
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
// if ( ui == EnumMapUI.CarUp_2D ) {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
// } else if( ui == EnumMapUI.NorthUP_2D ){
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
}
@@ -1423,20 +1402,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
@Override
public void updateMonitoringStatus(boolean hasError){
Log.d(TAG,"updateCheckStatus");
if(hasError==true){
tipImageView.setVisibility(View.VISIBLE);
}else{
tipImageView.setVisibility(View.INVISIBLE);
public void updateMonitoringStatus(boolean hasError) {
Log.d(TAG, "updateCheckStatus");
if (hasError == true) {
tipImageView.setVisibility(View.VISIBLE);
} else {
tipImageView.setVisibility(View.INVISIBLE);
}
}
public void onArriveAt(AdasOCHData data) {
}
@Override
public void onStateChanged(int state, String reason) {
// ctvAutopilotStatus.setChecked(state == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
}
}

View File

@@ -8,7 +8,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.windowview.IMogoEntranceViewListener;
@@ -71,16 +70,6 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
EntranceViewHolder.getInstance().removeEntranceViewListener(listener);
}
@Override
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
EntranceViewHolder.getInstance().addEntranceAutopilotStatusClickListener(listener);
}
@Override
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
EntranceViewHolder.getInstance().removeEntranceAutopilotStatusClickListener(listener);
}
@Override
public void init( Context context ) {

View File

@@ -12,7 +12,6 @@ import android.widget.TextView;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.service.windowview.IMogoEntranceViewListener;
import com.mogo.utils.logger.Logger;
@@ -133,7 +132,7 @@ public class EntranceViewHolder {
View v = wrapper.getView();
v.setLayoutParams(params);
rootViewGroup.addView(v, 0);
// rootViewGroup.setBackgroundColor(Color.WHITE);
// rootViewGroup.setBackgroundColor(Color.WHITE);
}
public void removeBottomLayerView(View view) {
@@ -270,7 +269,6 @@ public class EntranceViewHolder {
}
private final List<IMogoEntranceViewListener> listeners = new ArrayList<>();
private final List<IMogoEntranceAutopilotStatusClickListener> btnClickListeners = new ArrayList<>();
public void addEntranceViewListener(IMogoEntranceViewListener listener) {
listeners.add(listener);
@@ -280,20 +278,6 @@ public class EntranceViewHolder {
listeners.remove(listener);
}
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
btnClickListeners.add(listener);
}
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
btnClickListeners.remove(listener);
}
public void entranceAutopilotStatusClick() {
for (IMogoEntranceAutopilotStatusClickListener listener : btnClickListeners) {
listener.click();
}
}
public void release() {
rootViewGroup = null;
featureViewGroup = null;

View File

@@ -61,6 +61,7 @@ dependencies {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-res')
implementation project(':core:mogo-core-function-call')
}
}

View File

@@ -10,7 +10,11 @@ import android.os.Handler;
import android.os.Message;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
@@ -19,10 +23,7 @@ import com.mogo.module.service.dispatch.model.DispatchServiceModel;
import com.mogo.module.service.dispatch.model.IDispatch;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
@@ -31,7 +32,7 @@ import java.util.List;
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
, IDispatchRemindClickListener
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMogoEntranceAutopilotStatusClickListener {
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMoGoCheckAutoPilotBtnListener {
private static final String TAG = "DispatchAutoPilotManager";
private static volatile DispatchAutoPilotManager instance;
@@ -95,7 +96,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
.registerCarLocationChangedListener(TAG, this);
mApis.getAdasControllerApi()
.addAdasOCHCallback(this);
mApis.getEntranceButtonController().addEntranceAutopilotStatusClickListener(this);
CallerHmiListenerManager.INSTANCE.addCheckAutoPilotBtnListener(TAG, this);
dispatchDialogManager = DispatchDialogManager.getInstance(context);
dispatchDialogManager.addIDispatchRemindListener(this);
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
@@ -152,6 +153,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
@Override
public void cancel(boolean manualTrigger) {
CallerHmiListenerManager.INSTANCE.removeCheckAutoPilotBtnListener(TAG);
dispatchDialogManager.releaseDialog();
DispatchServiceModel.getInstance().dispatchResultUpload(manualTrigger ? DISPATCH_RESULT_MANUAL_CANCEL
: DISPATCH_RESULT_TIMER_CANCEL, new IDispatch() {
@@ -209,19 +211,25 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
this.reason = reason;
}
@Override
public void click() {
// 确保到达终点后,再次点击,不会有回馈,并且在下次调开始时,才会重置
if (isArriveEnd) {
return;
}
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
if (isDispatch ) {
startAutoPilot();
public void onCheck(boolean isChecked) {
if (isChecked) {
// 确保到达终点后,再次点击,不会有回馈,并且在下次调开始时,才会重置
if (isArriveEnd) {
return;
}
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
if (isDispatch) {
startAutoPilot();
}
} else {
mApis.getAdasControllerApi().cancelAutopilot();
}
}
public void testAutopilotStatus() {
autoPilotStatus = 2;
}

View File

@@ -1,6 +0,0 @@
package com.mogo.service.entrance;
public interface IMogoEntranceAutopilotStatusClickListener {
void click();
}

View File

@@ -151,18 +151,4 @@ public interface IMogoEntranceButtonController extends IProvider {
* @param listener 回调监听
*/
void removeEntranceViewListener(IMogoEntranceViewListener listener);
/**
* 添加entrance 自动驾驶状态监听
*
* @param listener {@link IMogoEntranceAutopilotStatusClickListener}
*/
void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener);
/**
* 移除entrance 自动驾驶状态监听
*
* @param listener {@link IMogoEntranceAutopilotStatusClickListener}
*/
void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener);
}