[fea]
[shuttle]
This commit is contained in:
yangyakun
2024-09-19 12:44:00 +08:00
parent d71492aa67
commit 09d30e06e5
6 changed files with 64 additions and 89 deletions

View File

@@ -41,8 +41,15 @@ import com.mogo.och.common.module.utils.createQRCodeWithPicture
import com.mogo.och.common.module.wigets.BindQRCodeDialog
import com.mogo.och.shuttle.weaknet.R
import com.mogo.och.weaknet.constant.BusConst
import com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
import com.mogo.och.weaknet.ui.taskrunned.RunningTaskManager
import com.mogo.och.weaknet.view.BizMapView
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.boneContainerView
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.bus_autopilot_btn_iv
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.bus_autopolot_btn_tv
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.mapBizView
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.module_mogo_och_autopilot_status
import kotlinx.android.synthetic.main.shuttle_weak_base_fragment.module_mogo_och_station_panel_container
import me.jessyan.autosize.utils.AutoSizeUtils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
@@ -57,11 +64,6 @@ import org.greenrobot.eventbus.ThreadMode
* @author tongchenfei
*/
class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnClickListener {
private var ctvAutopilotStatus: RelativeLayout? = null
private var ctvAutopilotStatusIv: ImageView? = null
private var ctvAutopilotStatusTv: TextView? = null
private var flStationPanelContainer: FrameLayout? = null
private var mapBizView: BizMapView? = null
private var autopilotLoadingAnimator: ObjectAnimator? = null
@@ -76,25 +78,17 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
}
override fun initViews() {
mapBizView = findViewById(R.id.mapBizView)
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status)
ctvAutopilotStatusIv = findViewById(R.id.bus_autopilot_btn_iv)
ctvAutopilotStatusTv = findViewById(R.id.bus_autopolot_btn_tv)
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container)
val flSpeed = findViewById<FrameLayout>(R.id.fl_speed)
if (flSpeed != null) {
attachAutopilotBeforeLaunchView(flSpeed.context, flSpeed)
context?.let {
boneContainerView.addBizView(SwitchBizView(it))
}
updateSwitchMapIcon()
initListener()
setAutopilotBtnStatus(
getState(),
isCanStartAutopilot(false, 0)
)
ctvAutopilotStatus!!.setOnClickListener(object : OnPreventFastClickListener() {
module_mogo_och_autopilot_status!!.setOnClickListener(object : OnPreventFastClickListener() {
override fun onClickImpl(v: View) {
}
@@ -124,19 +118,6 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
return super.onCreateView(inflater, container, savedInstanceState)
}
private fun updateSwitchMapIcon() {
val mapUIController = getMapUIController(MogoMap.DEFAULT)
if (mapUIController != null) {
if (isB2(FunctionBuildConfig.appIdentityMode)) {
mapUIController.changeCurrentIcon(R.raw.m2)
HdMapBuildConfig.currentCarVrIconRes = R.raw.m2
} else if (isB1(FunctionBuildConfig.appIdentityMode)) {
mapUIController.changeCurrentIcon(R.raw.xiaoba)
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaoba
}
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapBizView!!.onSaveInstanceState(outState)
@@ -182,39 +163,39 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
fun setAutopilotBtnStatus(autopilotStatus: Int, canStartAuto: Boolean) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE == autopilotStatus) { //0不可用
ctvAutopilotStatusTv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
ctvAutopilotStatusTv!!.text =
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.setBackgroundResource(R.drawable.common_autopilot_start_fail)
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_start_fail)
} else {
ctvAutopilotStatusTv!!.setTextColor(
bus_autopolot_btn_tv!!.setTextColor(
AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal)
)
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_ic_autopilot)
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_ic_autopilot)
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
ctvAutopilotStatusTv!!.text =
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
if (canStartAuto) {
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.setBackgroundResource(R.drawable.common_autopilot_press)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_press)
} else {
ctvAutopilotStatusTv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.setBackgroundResource(R.drawable.common_autopilot_start_fail)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_start_fail)
}
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
ctvAutopilotStatusTv!!.setText(R.string.bus_loading_autopilot_runnig_tv)
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatus!!.setBackgroundResource(R.drawable.common_autopilot_in_autopilot)
bus_autopolot_btn_tv!!.setText(R.string.bus_loading_autopilot_runnig_tv)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_in_autopilot)
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
== autopilotStatus
) {
ctvAutopilotStatusTv!!.setText(R.string.bus_pingxing_driver)
ctvAutopilotStatus!!.isClickable = false
ctvAutopilotStatus!!.setBackgroundResource(R.drawable.common_autopilot_pxjs)
bus_autopolot_btn_tv!!.setText(R.string.bus_pingxing_driver)
module_mogo_och_autopilot_status!!.isClickable = false
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_pxjs)
}
}
}
@@ -223,19 +204,19 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
== autopilotStatus
) { //2 running
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_right_autopilot_icon)
ctvAutopilotStatusTv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatusTv!!.text =
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_right_autopilot_icon)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv)
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus!!.isClickable = false
// module_mogo_och_autopilot_status.setSelected(false);
module_mogo_och_autopilot_status!!.isClickable = false
} else {
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
ctvAutopilotStatusTv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatusTv!!.text =
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv)
ctvAutopilotStatus!!.isClickable = false
// ctvAutopilotStatus.setSelected(false);
module_mogo_och_autopilot_status!!.isClickable = false
// module_mogo_och_autopilot_status.setSelected(false);
}
UiThreadHandler.postDelayed({
setAutopilotBtnStatus(
@@ -273,13 +254,13 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
*/
fun startAutopilotAnimation() {
isAnimateRunning = true
ctvAutopilotStatusTv!!.text =
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_tv)
ctvAutopilotStatusTv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
ctvAutopilotStatus!!.isClickable = true
ctvAutopilotStatusIv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
module_mogo_och_autopilot_status!!.isClickable = true
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
if (autopilotLoadingAnimator == null) {
autopilotLoadingAnimator = ObjectAnimator.ofFloat(ctvAutopilotStatusIv!!, "rotation", 0f, 360f)
autopilotLoadingAnimator = ObjectAnimator.ofFloat(bus_autopilot_btn_iv!!, "rotation", 0f, 360f)
autopilotLoadingAnimator?.interpolator = LinearInterpolator()
autopilotLoadingAnimator?.repeatCount = -1 //无限循环
autopilotLoadingAnimator?.setDuration(1000) //设置持续时间
@@ -306,7 +287,7 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>(), View.OnC
protected fun stopAutopilotAnimation() {
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator!!.end()
ctvAutopilotStatusIv!!.clearAnimation()
bus_autopilot_btn_iv!!.clearAnimation()
autopilotLoadingAnimator = null
isAnimateRunning = false
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 355 KiB

View File

@@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
android:layout_height="match_parent">
<com.mogo.och.weaknet.view.BizMapView
android:id="@+id/mapBizView"
@@ -18,15 +17,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_618"
android:layout_height="@dimen/dp_269"
android:layout_marginStart="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--V2X预警红色边框-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
android:layout_width="match_parent"
@@ -146,7 +136,7 @@
android:background="@drawable/bus_autopilot_0_1_status_bg"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
app:layout_constraintTop_toBottomOf="parent"
tools:visibility="visible">
<ImageView
@@ -192,11 +182,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.eagle.core.function.hmi.bone.BoneContainerView
android:id="@+id/boneContainerView"
android:layout_width="@dimen/dp_1046"
android:layout_height="match_parent"
android:elevation="100dp"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_964"
android:layout_height="@dimen/dp_1051"
android:layout_width="@dimen/dp_962"
android:layout_height="@dimen/dp_1047"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/bus_biz_bg">
@@ -10,7 +10,7 @@
android:src="@drawable/bus_biz_bg_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_42"
android:layout_width="@dimen/dp_856"
android:layout_height="@dimen/dp_100"/>
@@ -28,7 +28,7 @@
<com.mogo.och.weaknet.ui.switchline.SwitchLineView
android:id="@+id/swtichLine"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -38,7 +38,7 @@
<com.mogo.och.weaknet.ui.switchtask.SwitchTaskView
android:id="@+id/swtichTask"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -48,7 +48,7 @@
<com.mogo.och.weaknet.ui.taskrunning.TaskRunningView
android:id="@+id/taskRunning"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View File

@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_385"
android:layout_marginStart="@dimen/dp_19"
android:elevation="1dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -1029,6 +1029,7 @@
<dimen name="dp_1003">1003dp</dimen>
<dimen name="dp_1017">1017dp</dimen>
<dimen name="dp_1046">1046dp</dimen>
<dimen name="dp_1047">1047dp</dimen>
<dimen name="dp_1051">1051dp</dimen>
<dimen name="dp_1055">1055dp</dimen>
<dimen name="dp_1090">1090dp</dimen>