[清扫车]清扫车菜单栏布局搭建和相关Java类转成kotlin

This commit is contained in:
bxb
2023-01-18 14:52:12 +08:00
parent a2c1971630
commit 57a02e188b
16 changed files with 441 additions and 424 deletions

View File

@@ -25,13 +25,12 @@ 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;
import com.mogo.och.sweeper.view.SweeperTaskMenuView;
import com.mogo.och.sweeper.view.SweeperTrafficDataView;
import com.mogo.och.sweeper.view.SweeperWorkModeView;
import androidx.constraintlayout.widget.Group;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
/**
* 网约车基础Fragment主要负责布局通用界面处理站点面板和通话面板互斥情况
* <p>
@@ -39,27 +38,33 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS
*
* @author tongchenfei
*/
public abstract class BaseSweeperTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener{
public abstract class BaseSweeperTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
private static final String TAG = "BaseOchFragment";
protected RelativeLayout mSettingBtn;
protected RelativeLayout mBadcaseBtn;
protected RelativeLayout mAICollectBtn;
//地图放大缩小
private ImageView mSwitchMapModeImage;
private FrameLayout mSwitchMapModeLayout;
//设置信息面板
protected FrameLayout mSettingBtn;
//安全员问题上报面板
protected FrameLayout mBadcaseBtn;
//道路状况上报面板
protected FrameLayout mAICollectBtn;
//任务列表面板
private FrameLayout flTaskListPanelContainer;
private Group groupTestPanel;
//清扫车车辆基本信息 速度 档位 转向灯 红绿灯等
private SweeperTrafficDataView mTrafficDataView;
private SweeperTrafficDataView mTrafficDataView;
//清扫车模式展示
private SweeperWorkModeView mClWorkMode;
//清扫车模式选择面板
private SweeperOperatePanelView mOperatePanel;
//当前任务操作菜单
private SweeperTaskMenuView mTaskMenu;
//当前任务面板
private SweeperCurrentTaskInfoView mCurrentTaskView;
public static final String TYPE_ENTRANCE = "entrance";
//远景和中景的切换
private ImageView mSwitchMapModeImage;
private LinearLayout mSwitchMapModeLayout;
public boolean isAnimateRunning = false;
@Override
@@ -79,49 +84,14 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
mSwitchMapModeImage = findViewById(R.id.sweeper_switch_model_icon);
mClWorkMode = findViewById(R.id.sweeper_cl_work_mode);
mOperatePanel = findViewById(R.id.module_mogo_och_sweeper_operate_panel);
updateSwitchMapIcon();
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
//切换地图的远近视图
if (MogoMapUIController.getInstance().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去掉
// 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去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
}
}
});
mClWorkMode.setOnClickListener(v -> {
if (mOperatePanel.getVisibility() == View.VISIBLE) {
mOperatePanel.setVisibility(View.GONE);
} else {
mOperatePanel.setVisibility(View.VISIBLE);
}
});
if (DebugConfig.isDebug()) {
mTrafficDataView.setLongClickable(true);
mTrafficDataView.setOnLongClickListener(v -> {
CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
return true;
});
}
mTaskMenu = findViewById(R.id.sweeper_task_menu);
mCurrentTaskView = findViewById(R.id.sweeper_current_task_view);
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
initListener();
//设置左下角四个按钮监听事件
setBottomBtnListener();
// 模拟 不可自动驾驶目前场景是刚开机adas还未和工控机连接
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
@@ -136,22 +106,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
);
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
mSettingBtn.setOnClickListener(v -> {
// TODO: 2021/12/9
CallerHmiManager.INSTANCE.showToolsView();
});
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
if (mAICollectBtn != null) {
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
}
private void updateSwitchMapIcon() {
@@ -171,14 +125,65 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
}
private void initListener() {
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMapListener(TYPE_ENTRANCE, this);
//清扫模式选择面板打开关闭处理
mClWorkMode.setOnClickListener(v -> {
if (mOperatePanel.getVisibility() == View.VISIBLE) {
mOperatePanel.setVisibility(View.GONE);
} else {
mOperatePanel.setVisibility(View.VISIBLE);
}
});
//任务操作菜单打开关闭处理
mCurrentTaskView.getIvMore().setOnClickListener(v -> {
if (mTaskMenu.getVisibility() == View.VISIBLE) {
mTaskMenu.setVisibility(View.GONE);
} else {
mTaskMenu.setVisibility(View.VISIBLE);
}
});
}
public View getPanelView() {
return panelView;
/**
* 任务列表面板
*
* @return
*/
public void setTaskListPanelView(boolean isShow) {
if (isShow){
panelView.setVisibility(View.VISIBLE);
}else{
panelView.setVisibility(View.GONE);
}
}
/**
* 清扫模式展示面板
*
* @return
*/
public SweeperWorkModeView getWorkModePanelView() {
return mClWorkMode;
}
/**
* 当前任务面板
*
* @return
*/
public SweeperCurrentTaskInfoView getCurrentTaskPanelView() {
return mCurrentTaskView;
}
/**
* 获取菜单view
*
* @return
*/
public View getTaskMenuView() {
return mTaskMenu;
}
/**
* 清扫车任务列表面板view在{@link #initViews()}时候添加到container中
*
@@ -186,13 +191,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
*/
public abstract int getTaskListPanelViewId();
/**
* 获取清扫车操作面板layout id
*
* @return
*/
public abstract int getSweepOperatePanelViewId();
/**
* 重新开启自动驾驶
*/
@@ -244,4 +242,54 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
groupTestPanel.setVisibility(View.VISIBLE);
}
}
/**
* 底部四个按钮监听
* 1.地图放大缩小
* 2.设置面板
* 3.安全员问题上报面板
* 4.道路状况上报面板
*/
private void setBottomBtnListener() {
updateSwitchMapIcon();
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
//切换地图的远近视图
if (MogoMapUIController.getInstance().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去掉
// 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去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_long);
}
}
});
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
mSettingBtn.setOnClickListener(v -> {
// TODO: 2021/12/9
CallerHmiManager.INSTANCE.showToolsView();
});
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
if (mAICollectBtn != null) {
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
}
}

View File

@@ -1,64 +1,53 @@
package com.mogo.och.sweeper.fragment
import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.bean.TaskInfoBean
import com.mogo.och.sweeper.presenter.SweeperPresenter
import com.mogo.och.sweeper.ui.adapter.TaskListAdapter
import kotlinx.android.synthetic.main.fragment_och_sweeper.*
import kotlinx.android.synthetic.main.sweeper_task_menu.*
/**
* 清扫车主界面
*/
class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresenter?>() {
private var mTaskRefresh: ImageView? = null //刷新任务列表按钮
private var mRecyclerView: RecyclerView? = null
private var mAdapter: TaskListAdapter? = null
private val mutableList:MutableList<TaskInfoBean> by lazy { mutableListOf() }
private val mutableList: MutableList<TaskInfoBean> by lazy { mutableListOf() }
override fun getTagName(): String {
return "SweepersFragment"
}
override fun initViews() {
super.initViews()
mTaskRefresh = findViewById(R.id.ivTaskRefresh)
mRecyclerView = findViewById(R.id.rvTaskList)
mutableList.add(TaskInfoBean(1,"环球贸易中心",1))
mutableList.add(TaskInfoBean(2,"环球贸易中心",1))
mutableList.add(TaskInfoBean(3,"环球贸易中心",1))
mutableList.add(TaskInfoBean(4,"环球贸易中心",1))
mutableList.add(TaskInfoBean(5,"环球贸易中心",1))
mutableList.add(TaskInfoBean(6,"环球贸易中心",1))
mutableList.add(TaskInfoBean(7,"环球贸易中心",1))
mutableList.add(TaskInfoBean(8,"环球贸易中心",1))
mutableList.add(TaskInfoBean(9,"环球贸易中心",1))
mutableList.add(TaskInfoBean(10,"环球贸易中心",1))
mAdapter= context?.let { TaskListAdapter(it,mutableList) }
val linearLayoutManager=LinearLayoutManager(context)
linearLayoutManager.orientation=LinearLayoutManager.VERTICAL
mRecyclerView?.layoutManager=linearLayoutManager
mRecyclerView?.adapter=mAdapter
mutableList.add(TaskInfoBean(1, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(2, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(3, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(4, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(5, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(6, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(7, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(8, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(9, "环球贸易中心", 1))
mutableList.add(TaskInfoBean(10, "环球贸易中心", 1))
mAdapter = context?.let { TaskListAdapter(it, mutableList) }
val linearLayoutManager = LinearLayoutManager(context)
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
rvTaskList?.layoutManager = linearLayoutManager
rvTaskList?.adapter = mAdapter
mAdapter?.setOnTaskItemClickListener(onTaskItemClickListener)
initListener()
}
override fun createPresenter(): SweeperPresenter {
return SweeperPresenter(this)
}
override fun onResume() {
super.onResume()
}
override fun getTaskListPanelViewId(): Int {
return R.layout.fragment_och_sweeper
}
override fun getSweepOperatePanelViewId(): Int {
return R.layout.sweeper_operate_panel_view
}
override fun restartAutopilot() {
if (!isAnimateRunning) {
mPresenter?.restartAutopilot()
@@ -78,11 +67,26 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
fun hideOchSweeper() {}
override fun debugAutoPilotStatus(status: Int) {
mPresenter!!.debugAutoPilotStatus(status)
mPresenter?.debugAutoPilotStatus(status)
}
private val onTaskItemClickListener=object : TaskListAdapter.TaskItemClickListener{
/**
* 设置各种监听事件
*/
private fun initListener() {
tvTaskFinish.setOnClickListener {
setTaskListPanelView(true)
taskMenuView.visibility = View.GONE
}
tvTaskConfirm.setOnClickListener {
setTaskListPanelView(false)
currentTaskPanelView.visibility = View.VISIBLE
}
}
private val onTaskItemClickListener = object : TaskListAdapter.TaskItemClickListener {
override fun onItemClick(position: Int) {
mAdapter?.selectPosition(position)
mAdapter?.selectPosition(position)
}
}

View File

@@ -0,0 +1,41 @@
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) {
}
}

View File

@@ -1,43 +1,24 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
public class SubTaskView extends ConstraintLayout {
private ImageView ivSubTask;
private TextView tvSubTaskName;
private TextView tvSubTaskDesc;
private ImageView ivSubTaskRightDownArrow;
public SubTaskView(@NonNull Context context) {
super(context);
/**
* 子任务View
*/
class SubTaskView : ConstraintLayout {
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
}
public SubTaskView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
public SubTaskView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_subtask_view, this)
}
public SubTaskView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_subtask_view, this);
ivSubTask = findViewById(R.id.ivSubTask);
tvSubTaskName = findViewById(R.id.tvSubTaskName);
tvSubTaskDesc = findViewById(R.id.tvSubTaskDesc);
ivSubTaskRightDownArrow = findViewById(R.id.ivRightDownArrow);
}
}
}

View File

@@ -1,54 +1,36 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_current_task_info.view.*
/**
* 清扫车当前任务信息展示
*/
public class SweeperCurrentTaskInfoView extends ConstraintLayout {
private TextView mTvTaskName;
private TextView mTvTaskTime;
private TextView mTvTaskState;
private ImageView mIvMore;
private SubTaskView mCurrentSubTask;
private SubTaskView mNextSubTask;
private SubTaskView mLastSubTask;
class SweeperCurrentTaskInfoView : ConstraintLayout {
private var menuView: SweeperTaskMenuView? = null
public SweeperCurrentTaskInfoView(@NonNull Context context) {
super(context);
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
}
public SweeperCurrentTaskInfoView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_current_task_info, this)
}
public SweeperCurrentTaskInfoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
/**
* 设置当前任务信息
*/
fun setCurrentTask(sweeperTaskMenuView: SweeperTaskMenuView?) {
menuView = sweeperTaskMenuView
}
public SweeperCurrentTaskInfoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_current_task_info, this);
mTvTaskName=findViewById(R.id.tvTaskName);
mTvTaskTime=findViewById(R.id.tvTaskTime);
mTvTaskState=findViewById(R.id.tvTaskState);
mIvMore=findViewById(R.id.ivMore);
mCurrentSubTask=findViewById(R.id.currentSubTask);
mNextSubTask=findViewById(R.id.nextSubTask);
mLastSubTask=findViewById(R.id.lastSubTask);
}
}
fun getIvMore():ImageView=ivMore
}

View File

@@ -1,33 +1,29 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;
import android.content.Context
import android.util.AttributeSet
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity
import android.widget.TextView
import android.view.LayoutInflater
import com.mogo.och.sweeper.R
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity;
import com.mogo.och.sweeper.R;
/**
* 限速
*/
class SweeperLimitingVelocityView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : IViewLimitingVelocity(context, attrs, defStyleAttr) {
private var limitingVelocity: TextView? = null
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class SweeperLimitingVelocityView extends IViewLimitingVelocity {
private TextView limitingVelocity;
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0) {
initView(context!!)
}
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context,attrs,0);
initView(context);
override fun updateLimitingSpeed(limitingSpeed: Int) {
super.updateLimitingSpeed(limitingSpeed)
limitingVelocity!!.text = limitingSpeed.toString()
}
@Override
public void updateLimitingSpeed(int limitingSpeed) {
super.updateLimitingSpeed(limitingSpeed);
limitingVelocity.setText(String.valueOf(limitingSpeed));
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this)
limitingVelocity = findViewById(R.id.tvLimitingVelocity)
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this);
limitingVelocity = findViewById(R.id.tvLimitingVelocity);
}
}
}

View File

@@ -3,8 +3,10 @@ package com.mogo.och.sweeper.view
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_task_menu.view.*
/**
* 清扫车任务操作菜单
@@ -20,4 +22,19 @@ class SweeperTaskMenuView:ConstraintLayout {
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_task_menu, this)
}
/**
* 设置是否是手动任务
* 1云端自动驾驶任务
* 2云端手动驾驶任务
* 3: 运营任务
*/
fun setMenuView(type:Int){
if (type==1){
tvTaskJumpOver.visibility= View.GONE
taskJumpLineView.visibility= View.GONE
}else{
tvTaskJumpOver.visibility= View.VISIBLE
taskJumpLineView.visibility= View.VISIBLE
}
}
}

View File

@@ -1,43 +1,31 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.sweeper.R;
import org.jetbrains.annotations.Nullable;
import android.content.Context
import android.util.AttributeSet
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
import android.widget.TextView
import android.view.LayoutInflater
import android.widget.ImageView
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.sweeper.R
/**
* 清扫车红绿灯view
*/
public class SweeperTrafficLightView extends IViewTrafficLight {
class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
IViewTrafficLight(context, attrs, defStyleAttr) {
private var mLightIconIV: ImageView? = null
private var mLightTimeTV: TextView? = null
private var mCurrentLightId = 0
private ImageView mLightIconIV;
private TextView mLightTimeTV;
private int mCurrentLightId;
public SweeperTrafficLightView(@Nullable Context context) {
this(context, null, 0);
init {
init(context)
}
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.sweeper_traffic_light_iv);
mLightTimeTV = findViewById(R.id.sweeper_traffic_light_time_tv);
private fun init(context: Context?) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true)
mLightIconIV = findViewById(R.id.sweeper_traffic_light_iv)
mLightTimeTV = findViewById(R.id.sweeper_traffic_light_time_tv)
}
/**
@@ -46,23 +34,21 @@ public class SweeperTrafficLightView extends IViewTrafficLight {
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
super.showWarningTrafficLight(checkLightId, lightSource)
mCurrentLightId = checkLightId
updateTrafficLightIcon(checkLightId)
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_gay_nor);
});
override fun disableWarningTrafficLight() {
super.disableWarningTrafficLight()
UiThreadHandler.post {
mCurrentLightId = 0
mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor)
}
}
/**
@@ -70,61 +56,47 @@ public class SweeperTrafficLightView extends IViewTrafficLight {
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
when (mCurrentLightId) {
1 -> changeCountdownRed(redNum)
2 -> changeCountdownYellow(yellowNum)
3 -> changeCountdownGreen(greenNum)
else -> UiThreadHandler.post { mLightTimeTV!!.text = "" }
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
override fun changeCountdownRed(redNum: Int) {
super.changeCountdownRed(redNum)
UiThreadHandler.post {
if (redNum > 0) {
mLightTimeTV.setText(String.valueOf(redNum));
mLightTimeTV!!.text = redNum.toString()
} else {
mLightTimeTV.setText("");
mLightTimeTV!!.text = ""
}
});
}
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
override fun changeCountdownGreen(greenNum: Int) {
super.changeCountdownGreen(greenNum)
UiThreadHandler.post {
if (greenNum > 0) {
mLightTimeTV.setText(String.valueOf(greenNum));
mLightTimeTV!!.text = greenNum.toString()
} else {
mLightTimeTV.setText("");
mLightTimeTV!!.text = ""
}
});
}
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
override fun changeCountdownYellow(yellowNum: Int) {
super.changeCountdownYellow(yellowNum)
UiThreadHandler.post {
if (yellowNum > 0) {
mLightTimeTV.setText(String.valueOf(yellowNum));
mLightTimeTV!!.text = yellowNum.toString()
} else {
mLightTimeTV.setText("");
mLightTimeTV!!.text = ""
}
});
}
}
/**
@@ -132,22 +104,14 @@ public class SweeperTrafficLightView extends IViewTrafficLight {
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_red_nor);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_lightyellow_nor);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_green_nor);
break;
default:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_gay_nor);
break;
private fun updateTrafficLightIcon(lightId: Int) {
UiThreadHandler.post {
when (lightId) {
1 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_red_nor)
2 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_lightyellow_nor)
3 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_green_nor)
else -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor)
}
});
}
}
}
}

View File

@@ -1,46 +1,24 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.och.sweeper.R
/**
* 清扫车模式信息展示
*/
public class SweeperWorkModeView extends ConstraintLayout {
private TextView mTvCleaningMode;
private TextView mtvCleaningDirection;
private TextView mTvCleaningIntensity;
private ImageView mIvOpenOperatePanel;
public SweeperWorkModeView(@NonNull Context context) {
super(context);
class SweeperWorkModeView : ConstraintLayout {
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
}
public SweeperWorkModeView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
public SweeperWorkModeView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_work_mode, this)
}
public SweeperWorkModeView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_work_mode, this);
mTvCleaningMode = findViewById(R.id.tvCleaningMode);
mtvCleaningDirection = findViewById(R.id.tvCleaningDirection);
mTvCleaningIntensity = findViewById(R.id.tvCleaningIntensity);
mIvOpenOperatePanel = findViewById(R.id.ivOpenOperatePanel);
}
}
}

View File

@@ -1,62 +1,46 @@
package com.mogo.och.sweeper.view;
package com.mogo.och.sweeper.view
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_turn_signal.view.*
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class TurnSignalView extends LinearLayout {
private ImageView turnLeftView;
private ImageView turnRightView;
public TurnSignalView(Context context) {
super(context);
class TurnSignalView : LinearLayout {
constructor(context: Context?) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
}
public TurnSignalView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
public TurnSignalView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TurnSignalView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_turn_signal, this);
turnLeftView = findViewById(R.id.turnLeftView);
turnRightView = findViewById(R.id.turnRightView);
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_turn_signal, this)
}
/**
* 展示左转向灯
*/
public void showLeftSignal(){
turnLeftView.setSelected(true);
turnRightView.setSelected(false);
fun showLeftSignal() {
turnLeftView?.isSelected = true
turnRightView?.isSelected = false
}
/**
* 展示右转向灯
*/
public void showRightSignal(){
turnLeftView.setSelected(false);
turnRightView.setSelected(true);
fun showRightSignal() {
turnLeftView?.isSelected = false
turnRightView?.isSelected = true
}
/**
* 默认情况及其直行时
*/
public void showDirection(){
turnLeftView.setSelected(false);
turnRightView.setSelected(false);
fun showDirection() {
turnLeftView?.isSelected = false
turnRightView?.isSelected = false
}
}
}

View File

@@ -9,7 +9,7 @@
<size
android:width="30dp"
android:height="30dp" />
<solid android:color="#2F6296"/>
<gradient android:angle="270" android:startColor="#2F6296" android:endColor="#263A5B"/>
</shape>
</rotate>
</item>

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<!--车辆基本交通信息-->
<com.mogo.och.sweeper.view.SweeperTrafficDataView
android:id="@+id/sweeper_arc"
android:layout_width="@dimen/dp_616"
@@ -12,6 +13,7 @@
android:layout_marginLeft="@dimen/dp_13"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<!--清扫模式面板-->
<com.mogo.och.sweeper.view.SweeperWorkModeView
android:id="@+id/sweeper_cl_work_mode"
android:layout_width="wrap_content"
@@ -21,7 +23,9 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sweeper_arc"
android:visibility="visible"/>
<!--清扫任务当前面板-->
<com.mogo.och.sweeper.view.SweeperCurrentTaskInfoView
android:id="@+id/sweeper_current_task_view"
app:layout_constraintTop_toBottomOf="@+id/sweeper_cl_work_mode"
android:layout_width="@dimen/dp_560"
android:layout_height="0dp"
@@ -32,6 +36,7 @@
android:layout_marginBottom="@dimen/dp_30"
android:visibility="visible"
/>
<!--当前任务操作面板-->
<com.mogo.och.sweeper.view.SweeperTaskMenuView
android:id="@+id/sweeper_task_menu"
android:layout_width="wrap_content"
@@ -39,6 +44,7 @@
app:layout_constraintStart_toEndOf="@+id/sweeper_cl_work_mode"
app:layout_constraintTop_toBottomOf="@+id/sweeper_cl_work_mode"
android:visibility="gone"/>
<!--清扫任务列表面板-->
<FrameLayout
android:id="@+id/module_mogo_och_task_list_container"
android:layout_width="wrap_content"
@@ -50,6 +56,7 @@
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
android:visibility="gone"
android:layout_marginBottom="@dimen/dp_30"/>
<!--清扫模式选择面板-->
<com.mogo.och.sweeper.ui.SweeperOperatePanelView
android:id="@+id/module_mogo_och_sweeper_operate_panel"
android:layout_width="wrap_content"
@@ -59,8 +66,8 @@
app:layout_constraintLeft_toRightOf="@id/sweeper_cl_work_mode"
app:layout_constraintTop_toTopOf="@id/sweeper_cl_work_mode"
tools:visibility="visible" />
<!--切换地图远近事件 @dimen/module_switch_map -->
<LinearLayout
<!--切换地图远近事件-->
<FrameLayout
android:id="@+id/sweeper_switch_model_layout"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
@@ -78,11 +85,10 @@
android:id="@+id/sweeper_switch_model_icon"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_centerInParent="true"
android:layout_gravity="center" />
</LinearLayout>
</FrameLayout>
<RelativeLayout
<FrameLayout
android:id="@+id/module_mogo_och_setting_layout"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
@@ -92,16 +98,15 @@
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/sweeper_switch_model_layout">
<ImageView
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/sweeper_setting_btn_bg" />
</RelativeLayout>
android:background="@drawable/sweeper_setting_btn_bg"
/>
</FrameLayout>
<RelativeLayout
<FrameLayout
android:id="@+id/module_mogo_och_badcase_rl"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
@@ -111,16 +116,14 @@
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout">
<ImageView
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:src="@drawable/bad_case_selector" />
</RelativeLayout>
</FrameLayout>
<RelativeLayout
<FrameLayout
android:id="@+id/module_mogo_och_ai_collet_rl"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
@@ -137,7 +140,7 @@
android:layout_centerInParent="true"
android:layout_gravity="center"
android:src="@drawable/ai_collect_selector" />
</RelativeLayout>
</FrameLayout>
<Button
android:id="@+id/btnAutopilotDisable"
android:layout_width="wrap_content"

View File

@@ -14,7 +14,7 @@
android:textColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="惠新西街南口地铁站"
android:text="惠新西街南口地铁站"
android:layout_marginStart="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_21"/>
<TextView
@@ -25,7 +25,7 @@
android:textColor="#A6CEFF"
app:layout_constraintTop_toBottomOf="@+id/tvTaskName"
app:layout_constraintStart_toStartOf="parent"
tools:text="全程包含12个子任务"
android:text="全程包含12个子任务"
android:layout_marginStart="@dimen/dp_38"
android:layout_marginTop="1dp"/>
<TextView
@@ -35,7 +35,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="9:00"
android:text="9:00"
android:textColor="@color/white"
android:paddingStart="@dimen/dp_12"
android:paddingEnd="@dimen/dp_12"

View File

@@ -34,7 +34,7 @@
android:textSize="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_16"/>
<View
android:id="@+id/line1"
android:id="@+id/taskJumpLineView"
android:layout_width="0dp"
android:layout_height="2dp"
app:layout_constraintStart_toEndOf="@+id/ivTriangle"
@@ -50,13 +50,13 @@
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/ivTriangle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/line1"
app:layout_constraintTop_toBottomOf="@+id/taskJumpLineView"
android:text="结束"
android:textColor="#A6CEFF"
android:textSize="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_16"/>
<View
android:id="@+id/line2"
android:id="@+id/taskFinishLineView"
android:layout_width="0dp"
android:layout_height="2dp"
app:layout_constraintStart_toEndOf="@+id/ivTriangle"
@@ -72,8 +72,8 @@
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/ivTriangle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/line2"
android:text="结束"
app:layout_constraintTop_toBottomOf="@+id/taskFinishLineView"
android:text="取消"
android:textColor="#A6CEFF"
android:textSize="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_16"/>

View File

@@ -17,5 +17,6 @@
android:layout_gravity="center"
android:gravity="center"
tools:text="10"
android:textColor="@color/white"/>
android:textColor="@color/white"
android:background="#00000000"/>
</FrameLayout>

View File

@@ -3,6 +3,7 @@
android:layout_width="@dimen/dp_560"
android:layout_height="@dimen/dp_170"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/bg_shape_work_mode"
android:id="@+id/clWorkMode">
<TextView
@@ -72,5 +73,22 @@
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_30"
android:src="@drawable/sweeper_clean_mode_icon"/>
<TextView
android:id="@+id/tvNoDataDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_16"
android:text="暂无"
android:textSize="@dimen/dp_34"
android:textColor="@color/white"
android:layout_marginStart="@dimen/dp_36"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/groupWorkModelPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="tvCleaningMode,tvCleaningDirection,tvCleaningIntensity"
/>
</androidx.constraintlayout.widget.ConstraintLayout>