[M1/shuttle] 加入平行驾驶

This commit is contained in:
wangmingjun
2023-03-10 00:35:25 +08:00
parent ccecb1948f
commit 88b8be2962
11 changed files with 100 additions and 63 deletions

View File

@@ -142,6 +142,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
IMogoMapUIController controller = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (controller != null) {
//切换地图的远近视图
@@ -192,6 +193,10 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
);
findViewById(R.id.btnAutopilotPingxing).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING)
);
// 模拟 自动驾驶网约车回调数据
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
debugArrivedStation()
@@ -392,23 +397,28 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_disable));
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
ctvAutopilotStatus.setSelected(false);
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackground(getContext().getDrawable(R.drawable.bus_autopilot_0_1_status_bg));
} else {
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_ic_autopilot);
ctvAutopilotStatus.setClickable(true);
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
ctvAutopilotStatus.setSelected(false);
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
ctvAutopilotStatus.setBackground(getContext().getDrawable(R.drawable.bus_autopilot_0_1_status_bg));
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
ctvAutopilotStatusTv.setText(R.string.bus_loading_autopilot_runnig_tv);
ctvAutopilotStatus.setSelected(true);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackground(getContext().getDrawable(R.drawable.bus_autopilot_2_status_bg));
// ctvAutopilotStatus.setSelected(true);
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
== autopilotStatus){
ctvAutopilotStatusTv.setText(R.string.bus_pingxing_driver);
ctvAutopilotStatusTv.setBackground(getContext().getDrawable(R.drawable.pingxingjiashi));
ctvAutopilotStatus.setClickable(false);
ctvAutopilotStatus.setBackground(getContext().getDrawable(R.drawable.pingxingjiashi));
}
}
@@ -420,14 +430,14 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_success_tv));
ctvAutopilotStatus.setSelected(false);
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(false);
} else {
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_failure_tv));
ctvAutopilotStatus.setClickable(false);
ctvAutopilotStatus.setSelected(false);
// ctvAutopilotStatus.setSelected(false);
}
UiThreadHandler.postDelayed(new Runnable() {
@Override
@@ -505,7 +515,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
isAnimateRunning = true;
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_tv));
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatus.setSelected(false);
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_loading_autopilot_icon);
if (autopilotLoadingAnimator == null) {

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:drawable="@drawable/start_success">
</item>
</selector>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_selected="true" android:drawable="@drawable/start_success">
</item>
<item android:state_selected="false" android:drawable="@drawable/start_failure">
</item>
<item android:state_focused="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_focused="false" android:drawable="@drawable/start_failure">
</item>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -171,7 +171,7 @@
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/dp_13"
android:background="@drawable/bus_autopilot_status_bg"
android:background="@drawable/bus_autopilot_0_1_status_bg"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
@@ -363,6 +363,16 @@
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
<Button
android:id="@+id/btnAutopilotPingxing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:text="pingxingjiashi"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<Button
android:id="@+id/btnAutopilotArrive"
android:layout_width="wrap_content"
@@ -371,7 +381,7 @@
android:text="Arrived"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
app:layout_constraintTop_toBottomOf="@id/btnAutopilotPingxing" />
<Button
android:id="@+id/btnAutopilotRoute"
@@ -390,7 +400,7 @@
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable
,btnAutopilotRunning,btnAutopilotRoute"
,btnAutopilotRunning,btnAutopilotRoute,btnAutopilotPingxing"
tools:visibility="visible" />
<com.mogo.eagle.core.function.smp.view.SmallMapView

View File

@@ -123,11 +123,6 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
override fun createPresenter(): DriverM1Presenter {
return DriverM1Presenter(this)
}
override fun debugAutoPilotStatus(status: Int) {
}
/**
* 更换路线目的地确认dialog
*/

View File

@@ -33,6 +33,7 @@ import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
import com.mogo.eagle.core.function.smp.view.SmallMapView
import com.mogo.eagle.core.function.view.MapBizView
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
@@ -103,6 +104,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
updateSwitchMapIcon()
mSwitchMapModeLayout!!.setOnClickListener(object : OnPreventFastClickListener() {
override fun onClickImpl(v: View) {
val controller = getMapUIController()
if (controller != null) {
//切换地图的远近视图
@@ -158,6 +160,12 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
)
}
findViewById<View>(R.id.btnAutopilotPingxing)!!.setOnClickListener { view: View? ->
debugAutoPilotStatus(
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
)
}
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout)
mSettingBtn!!.setOnClickListener { v: View? ->
// TODO: 2021/12/9
@@ -312,23 +320,28 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
ctvAutopilotStatusTv!!.text =
resources.getString(R.string.bus_loading_autopilot_runnig_tv)
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
ctvAutopilotStatus!!.isSelected = false
// ctvAutopilotStatus!!.isSelected = false
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.background = getDrawable(R.drawable.bus_autopilot_0_1_status_bg)
}else{
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_ic_autopilot)
ctvAutopilotStatus!!.isClickable = true
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
ctvAutopilotStatus!!.isSelected = false
// ctvAutopilotStatus!!.isSelected = false
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.background = getDrawable(R.drawable.bus_autopilot_0_1_status_bg)
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
ctvAutopilotStatusTv!!.text =
resources.getString(R.string.bus_loading_autopilot_runnig_tv)
ctvAutopilotStatus!!.isSelected = true
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.background = getDrawable(R.drawable.bus_autopilot_2_status_bg)
// ctvAutopilotStatus!!.isSelected = true
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
== autopilotStatus){
ctvAutopilotStatusTv!!.text =
resources.getString(R.string.bus_loading_autopilot_pingxing_tv)
ctvAutopilotStatusTv!!.background = context?.getDrawable(R.drawable.pingxingjiashi)
ctvAutopilotStatus!!.isClickable = false
ctvAutopilotStatus!!.background = getDrawable(R.drawable.pingxingjiashi)
}
}
}
@@ -341,7 +354,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatusTv!!.text =
resources.getString(R.string.bus_loading_autopilot_success_tv)
ctvAutopilotStatus!!.isSelected = false
// ctvAutopilotStatus!!.isSelected = false
ctvAutopilotStatus!!.isClickable = false
} else {
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
@@ -349,7 +362,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
ctvAutopilotStatusTv!!.text =
resources.getString(R.string.bus_loading_autopilot_failure_tv)
ctvAutopilotStatus!!.isClickable = false
ctvAutopilotStatus!!.isSelected = false
// ctvAutopilotStatus!!.isSelected = false
}
UiThreadHandler.postDelayed({ setAutopilotBtnStatus(autopilotStatus) }, 1000)
}
@@ -398,8 +411,9 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
*
* @param status
*/
abstract fun debugAutoPilotStatus(status: Int)
private fun debugAutoPilotStatus(status: Int){
setAutopilotBtnStatus(status)
}
/**
* 开启自动驾驶中间动画
*/
@@ -408,7 +422,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
isAnimateRunning = true
ctvAutopilotStatusTv!!.text = resources.getString(R.string.bus_loading_autopilot_tv)
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatus!!.isSelected = false
// ctvAutopilotStatus!!.isSelected = false
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
if (autopilotLoadingAnimator == null) {

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:drawable="@drawable/start_success">
</item>
</selector>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_selected="true" android:drawable="@drawable/start_success">
</item>
<item android:state_selected="false" android:drawable="@drawable/start_failure">
</item>
<item android:state_focused="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_focused="false" android:drawable="@drawable/start_failure">
</item>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -171,7 +171,7 @@
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/dp_13"
android:background="@drawable/bus_autopilot_status_bg"
android:background="@drawable/bus_autopilot_0_1_status_bg"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
@@ -312,6 +312,16 @@
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
<Button
android:id="@+id/btnAutopilotPingxing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:text="pingxingjiashi"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<Button
android:id="@+id/btnAutopilotArrive"
android:layout_width="wrap_content"
@@ -320,7 +330,7 @@
android:text="Arrived"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
app:layout_constraintTop_toBottomOf="@id/btnAutopilotPingxing" />
<Button
android:id="@+id/btnAutopilotRoute"
@@ -339,7 +349,7 @@
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable
,btnAutopilotRunning,btnAutopilotRoute"
,btnAutopilotRunning,btnAutopilotRoute,btnAutopilotPingxing"
tools:visibility="visible" />
<com.mogo.eagle.core.function.smp.view.SmallMapView