diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index 33177ec7b0..3c5e6e5711 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -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,主要负责布局通用界面,处理站点面板和通话面板互斥情况 *

@@ -39,27 +38,33 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS * * @author tongchenfei */ -public abstract class BaseSweeperTabFragment> extends MvpFragment implements IMogoMapListener{ +public abstract class BaseSweeperTabFragment> extends MvpFragment 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 { - 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 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 { + 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 { + // 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); + } + } + } diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.kt index d766d121c3..81ed6495ff 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.kt +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.kt @@ -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() { - private var mTaskRefresh: ImageView? = null //刷新任务列表按钮 - private var mRecyclerView: RecyclerView? = null private var mAdapter: TaskListAdapter? = null - private val mutableList:MutableList by lazy { mutableListOf() } + private val mutableList: MutableList 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 { - 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) } - }); + } } -} +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperWorkModeView.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperWorkModeView.kt index b00294267a..1b1e145d05 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperWorkModeView.kt +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperWorkModeView.kt @@ -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); - } -} +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/TurnSignalView.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/TurnSignalView.kt index 9ad5640dca..23c6d1dc1f 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/TurnSignalView.kt +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/TurnSignalView.kt @@ -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 } -} +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_bubble.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_bubble.xml index 73729e9ef6..491598a373 100644 --- a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_bubble.xml +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_bubble.xml @@ -9,7 +9,7 @@ - + diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index b6544ba351..bd02cb7c77 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="@dimen/dp_72"> + + + + + + - - + - + - - - + android:background="@drawable/sweeper_setting_btn_bg" + /> + - - - + - - +