diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/ShuttleFragment.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/ShuttleFragment.kt index f0369d4ebc..638bffd274 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/ShuttleFragment.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/ShuttleFragment.kt @@ -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(), 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(), 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(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(), 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(), 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(), 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(), 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(), View.OnC protected fun stopAutopilotAnimation() { if (autopilotLoadingAnimator != null) { autopilotLoadingAnimator!!.end() - ctvAutopilotStatusIv!!.clearAnimation() + bus_autopilot_btn_iv!!.clearAnimation() autopilotLoadingAnimator = null isAnimateRunning = false } diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png index b65431da08..f92a934e07 100755 Binary files a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml index b3a4f1809d..b1b29797f3 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml @@ -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"> - - - - - + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml index 0887e1fa11..b58ad24adc 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml @@ -1,8 +1,8 @@ @@ -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 @@ diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index fa65ef033e..4d28213fee 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -1029,6 +1029,7 @@ 1003dp 1017dp 1046dp + 1047dp 1051dp 1055dp 1090dp