[8.5.0]
[singapore] [添加算路验证模式]
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.mogo.och.unmanned.ui.modeswitch
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class SwtichBizeModel : ViewModel() {
|
||||
|
||||
private val TAG = SwtichBizeModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: SwtichLineViewCallback? = null
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
this.viewCallback?.showTaskView()
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(
|
||||
TAG, StatusDescriptor.TAXI_UNMANED_DRIVER_LINE_ROUTING_VERIFY_MODE, moFanglistener
|
||||
)
|
||||
}
|
||||
|
||||
private var moFanglistener: IMogoStatusChangedListener? = object : IMogoStatusChangedListener {
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (StatusDescriptor.TAXI_UNMANED_DRIVER_LINE_ROUTING_VERIFY_MODE == descriptor) {
|
||||
UiThreadHandler.post {
|
||||
if (isTrue) {// 展示算路
|
||||
viewCallback?.showRoutingView()
|
||||
} else {// 展示任务
|
||||
viewCallback?.showTaskView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface SwtichLineViewCallback {
|
||||
fun showTaskView()
|
||||
fun showRoutingView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.mogo.och.unmanned.ui.modeswitch
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.och.common.module.biz.routing.RoutingManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.wigets.WindowRelativeLayout
|
||||
import com.mogo.och.shuttle.unmanned.R
|
||||
import kotlinx.android.synthetic.main.shuttle_unmanned_biz.view.routingSwitchView
|
||||
import kotlinx.android.synthetic.main.shuttle_unmanned_biz.view.switchUnmannedOchBiz
|
||||
|
||||
class TopSwitchBizView : WindowRelativeLayout {
|
||||
class TopSwitchBizView : WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallback {
|
||||
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
@@ -22,6 +29,9 @@ class TopSwitchBizView : WindowRelativeLayout {
|
||||
const val TAG = "TopSwitchBizView"
|
||||
}
|
||||
|
||||
private var viewModel: SwtichBizeModel?=null
|
||||
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.shuttle_unmanned_biz, this, true)
|
||||
@@ -29,12 +39,41 @@ class TopSwitchBizView : WindowRelativeLayout {
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(SwtichBizeModel::class.java)
|
||||
}
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
RoutingManager.getRoutingView()?.let {
|
||||
routingSwitchView.removeView(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showTaskView() {
|
||||
switchUnmannedOchBiz.visibility = VISIBLE
|
||||
routingSwitchView.visibility = GONE
|
||||
RoutingManager.getRoutingView()?.let {
|
||||
routingSwitchView.removeView(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showRoutingView() {
|
||||
switchUnmannedOchBiz.visibility = GONE
|
||||
routingSwitchView.visibility = VISIBLE
|
||||
RoutingManager.getRoutingView()?.let {
|
||||
try {
|
||||
if (it.parent!=null) {
|
||||
(it.parent as ViewGroup).removeAllViews()
|
||||
}
|
||||
routingSwitchView.addView(it)
|
||||
}catch (e:Exception){
|
||||
OchChainLogManager.writeChainLogError("添加routingview错误:TopSwitchBizView",e.message?:"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="1647dp"
|
||||
android:layout_height="1536dp"
|
||||
android:background="@drawable/unmanned_bus_biz_bg">
|
||||
android:background="@drawable/unmanned_bus_biz_bg"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
@@ -43,5 +44,24 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/unmanned_guideline_v_left"
|
||||
app:layout_constraintTop_toTopOf="@+id/unmanned_guideline_h_top" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/routingSwitchView"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/unmanned_guideline_v_bottom"
|
||||
app:layout_constraintEnd_toEndOf="@id/unmanned_guideline_v_right"
|
||||
app:layout_constraintStart_toStartOf="@+id/unmanned_guideline_v_left"
|
||||
app:layout_constraintTop_toTopOf="@+id/unmanned_guideline_h_top"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.KeyboarView
|
||||
android:id="@+id/common_global_keyboard"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_221"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="@dimen/dp_656"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user