[清扫车][ 1、修复合并3.0出现的页面逻辑冲突]
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
package com.mogo.och.sweeper.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
@@ -17,12 +14,13 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
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.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.sweeper.R;
|
||||
import com.mogo.och.sweeper.ui.SweeperOperatePanelView;
|
||||
import com.mogo.och.sweeper.view.SweeperCurrentTaskInfoView;
|
||||
@@ -109,13 +107,17 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
}
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
IMogoMapUIController controller = CallerMapUIServiceManager.INSTANCE.getMapUIController();
|
||||
if (controller!=null){
|
||||
if (controller.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
} else if (controller.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +129,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMapListener(TYPE_ENTRANCE, this);
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, this);
|
||||
//清扫模式选择面板打开关闭处理
|
||||
mClWorkMode.setOnClickListener(v -> {
|
||||
if (mOperatePanel.getVisibility() == View.VISIBLE) {
|
||||
@@ -218,7 +220,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoMapListener(TYPE_ENTRANCE);
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,23 +257,27 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
//切换地图的远近视图
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
// 2.11.0去掉
|
||||
IMogoMapUIController controller = CallerMapUIServiceManager.INSTANCE.getMapUIController();
|
||||
IMogoMarkerManager markerManager = CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp());
|
||||
if (controller != null && markerManager != null) {
|
||||
//切换地图的远近视图
|
||||
if (controller.getCurrentMapVisualAngle().isLongSight()) {
|
||||
// 2.11.0去掉
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
// 2.11.0去掉
|
||||
controller.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_medium);
|
||||
} else if (controller.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
// 2.11.0去掉
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, BusConst.TYPE_MARKER_BUS_ORDER);
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
} else {
|
||||
// 2.11.0去掉
|
||||
controller.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
} else {
|
||||
// 2.11.0去掉
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
controller.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.och.sweeper.listener;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import chassis.Chassis;
|
||||
|
||||
public abstract class FuTianVehicleStateListener implements IMoGoAutopilotVehicleStateListener{
|
||||
@Override
|
||||
public void onAutopilotLightSwitchData(@Nullable Chassis.LightSwitch lightSwitch) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotGearData(@NonNull Chassis.GearPosition gear) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
}
|
||||
}
|
||||
@@ -20,17 +20,17 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.sweeper.R
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* 车辆基本信息:方向盘下方的档位 转向灯 限速 速度 电量 水量
|
||||
*/
|
||||
class SweeperTrafficDataView : ConstraintLayout,
|
||||
IMoGoBatteryManagementSystemListener,
|
||||
IMoGoChassisLamplightListener,
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
IMoGoChassisGearStateListener,
|
||||
IMoGoSweeperFutianCleanSystemListener
|
||||
{
|
||||
private var tapPositionView //方向盘
|
||||
private var tapPositionView //方向盘下方的档位
|
||||
: TapPositionView? = null
|
||||
private var speedImage //速度图标
|
||||
: ImageView? = null
|
||||
@@ -49,6 +49,8 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
private var trafficLight //红绿灯
|
||||
: SweeperTrafficLightView? = null
|
||||
|
||||
private val TAG = "SweeperTrafficDataView"
|
||||
|
||||
constructor(context: Context) : super(context) {}
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
|
||||
initView(context)
|
||||
@@ -73,10 +75,8 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerBatteryManagementSystemListenerManager.addListener(TAG, this)
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
CallerChassisGearStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
|
||||
CallerSweeperFutianCleanSystemListenerManager.addListener(TAG, this)
|
||||
//增加限速监听
|
||||
CallLimitingVelocityListenerManager.addListener(TAG, limitingVelocityListener)
|
||||
@@ -109,11 +109,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
override fun onBatteryManagementSystemStates(states: BMSSystemStates) {
|
||||
tvBattery?.text = String.format("%s%", states.bmsSoc)
|
||||
}
|
||||
|
||||
override fun onAutopilotThrottle(throttle: Float) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆转向灯
|
||||
* @param lightSwitch
|
||||
@@ -139,22 +134,8 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
d(TAG, "刹车灯:$brakeLight")
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
override fun onAutopilotSteeringData(steering: Float) {
|
||||
var steering = steering
|
||||
d(TAG, "steering原始值====$steering")
|
||||
if (abs(steering) < 1) {
|
||||
steering = 0f
|
||||
}
|
||||
d(TAG, "steering忽略小数点后====" + steering.toInt())
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* 方向盘下方的档位
|
||||
* @param gear
|
||||
*/
|
||||
override fun onAutopilotGearData(gear: GearPosition) {
|
||||
@@ -181,8 +162,4 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
speedTextView?.text = newSpeed.toString()
|
||||
speedImage?.setBackgroundResource(if (newSpeed > 60) R.drawable.sweeper_traffic_data_speed_warning else R.drawable.sweeper_bg_traffic_data_speed)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SweeperTrafficDataView"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user