[6.4.0]
[包车乘客屏debugview展示]
This commit is contained in:
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
|
||||
@@ -16,6 +17,8 @@ import com.mogo.och.charter.passenger.bean.response.OrderInfoResponse
|
||||
import com.mogo.och.charter.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.charter.passenger.ui.MainFragment
|
||||
import com.mogo.och.charter.passenger.ui.statusbar.StatusBarView
|
||||
import com.mogo.och.common.module.biz.provider.CommonService
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.common.module.manager.debug.DebugViewWatchDogFragment
|
||||
import kotlinx.android.synthetic.main.charter_p_debug.view.debug_arrive_dest
|
||||
@@ -45,6 +48,21 @@ class DebugView @JvmOverloads constructor(
|
||||
|
||||
private var fragment: MainFragment?=null
|
||||
|
||||
private fun getFragment():MainFragment?{
|
||||
if(fragment==null) {
|
||||
(ARouter.getInstance().build(OchCommonConst.CHARTER_PASSENGER)
|
||||
.navigation() as? CommonService)?.apply {
|
||||
context?.let {
|
||||
val fragmentTemp = getFragment()
|
||||
if (fragmentTemp is MainFragment) {
|
||||
fragment = fragmentTemp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return fragment
|
||||
}
|
||||
|
||||
private var debugViewWatchDogFragment: WeakReference<DebugViewWatchDogFragment>? = null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -52,45 +70,37 @@ class DebugView @JvmOverloads constructor(
|
||||
|
||||
EventBus.getDefault().register(this)
|
||||
|
||||
val activityByContext = ActivityUtils.getActivityByContext(context)
|
||||
if(activityByContext is FragmentActivity){
|
||||
val fragment = activityByContext.supportFragmentManager.findFragmentByTag(MainFragment.TAG)
|
||||
if(fragment is MainFragment){
|
||||
this.fragment = fragment
|
||||
}
|
||||
}
|
||||
|
||||
debug_arrive_dest.setOnClickListener {
|
||||
CharterPassengerModel.arriveDest()
|
||||
}
|
||||
debug_show_noviceGuidance.setOnClickListener {
|
||||
fragment?.showNoviceGuidanceFragment()
|
||||
getFragment()?.showNoviceGuidanceFragment()
|
||||
}
|
||||
debug_change_modle.setOnClickListener {
|
||||
ToastCharterUtils.showToastShort("因车辆正在人工驾驶中无法靠边停车,请安全员主动停止车辆")
|
||||
when (HdMapBuildConfig.currentCarVrIconRes) {
|
||||
R.raw.aiqinghao -> {
|
||||
fragment?.setCarMode(OrderInfoResponse.M1_FAMILY)
|
||||
getFragment()?.setCarMode(OrderInfoResponse.M1_FAMILY)
|
||||
}
|
||||
R.raw.jiatinghao -> {
|
||||
fragment?.setCarMode(OrderInfoResponse.M1_FRIENDLY)
|
||||
getFragment()?.setCarMode(OrderInfoResponse.M1_FRIENDLY)
|
||||
}
|
||||
R.raw.pengyouhao -> {
|
||||
fragment?.setCarMode(0)
|
||||
getFragment()?.setCarMode(0)
|
||||
}
|
||||
else -> {
|
||||
fragment?.setCarMode(OrderInfoResponse.M1_LOVE)
|
||||
getFragment()?.setCarMode(OrderInfoResponse.M1_LOVE)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
debug_show_endview.setOnClickListener {
|
||||
fragment?.showOpenAndCloseDoor()
|
||||
getFragment()?.showOpenAndCloseDoor()
|
||||
}
|
||||
|
||||
debug_show_overmap_point.onClick {
|
||||
fragment?.showOvermapPoint()
|
||||
getFragment()?.showOvermapPoint()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +130,7 @@ class DebugView @JvmOverloads constructor(
|
||||
debugViewWatchDogFragment = WeakReference(DebugViewWatchDogFragment.newInstance())
|
||||
}
|
||||
val debugViewFragment = debugViewWatchDogFragment?.get()
|
||||
fragment?.let {
|
||||
getFragment()?.let {
|
||||
DebugViewWatchDogFragment.showDebugView(it.childFragmentManager,it.parentFragmentManager,debugViewFragment)
|
||||
}
|
||||
}
|
||||
@@ -129,6 +139,7 @@ class DebugView @JvmOverloads constructor(
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
fragment = null
|
||||
super.onDetachedFromWindow()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user