diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt index 22a28ddd8c..a7e1eb3083 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt @@ -2,15 +2,19 @@ package com.mogo.och.common.module.wigets.map.orderstatus import android.content.Context import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.RelativeLayout import androidx.appcompat.widget.AppCompatImageView +import androidx.constraintlayout.widget.ConstraintLayout import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner import com.mogo.och.common.module.R +import kotlinx.android.synthetic.main.common_order_status_view.view.iv_order_status /** * */ -class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback { +class OrderStatusView : RelativeLayout, OrderStatusViewModel.IVisualCallback { private val TAG = "VisualView" @@ -25,7 +29,7 @@ class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback ) private fun initView() { - setImageResource(R.drawable.common_status_unorder) + LayoutInflater.from(context).inflate(R.layout.common_order_status_view, this, true) } override fun onAttachedToWindow() { @@ -48,8 +52,20 @@ class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback } } - override fun setImageViewResource(name: Int) { - setImageResource(name) + override fun setImageViewResource(name: Int,ordering:Boolean) { + iv_order_status.setImageResource(name) + if (iv_order_status.layoutParams is RelativeLayout.LayoutParams) { + val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams + temp.removeRule(RelativeLayout.ALIGN_PARENT_START) + temp.addRule(ALIGN_PARENT_END) + iv_order_status.layoutParams = temp + }else{ + val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams + temp.removeRule(RelativeLayout.ALIGN_PARENT_END) + temp.addRule(ALIGN_PARENT_START) + iv_order_status.layoutParams = temp + } + } diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt index ad8e90818d..82f4b26dfe 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt @@ -32,16 +32,17 @@ class OrderStatusViewModel : ViewModel(), ILoginCallback { override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) { UiThreadHandler.post({ if (LoginStatusManager.isOpenOrderType()) { - this.viewCallback?.setImageViewResource(R.drawable.common_status_ordinging) + this.viewCallback?.setImageViewResource(R.drawable.common_order_status,true) } else { - this.viewCallback?.setImageViewResource(R.drawable.common_status_unorder) + this.viewCallback?.setImageViewResource(R.drawable.common_unorder_status,false) } + }, UiThreadHandler.MODE.QUEUE) } interface IVisualCallback { - fun setImageViewResource(@DrawableRes name: Int) + fun setImageViewResource(@DrawableRes name: Int,ordering:Boolean) } } \ No newline at end of file diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_order_status.png b/OCH/common/common/src/main/res/drawable-nodpi/common_order_status.png new file mode 100755 index 0000000000..869a3eeb4f Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_order_status.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_order_status_bg.png b/OCH/common/common/src/main/res/drawable-nodpi/common_order_status_bg.png new file mode 100755 index 0000000000..f84de094a2 Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_order_status_bg.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_unorder_status.png b/OCH/common/common/src/main/res/drawable-nodpi/common_unorder_status.png new file mode 100755 index 0000000000..52e9b671fc Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_unorder_status.png differ diff --git a/OCH/common/common/src/main/res/layout/common_order_status_view.xml b/OCH/common/common/src/main/res/layout/common_order_status_view.xml new file mode 100644 index 0000000000..f471a2180d --- /dev/null +++ b/OCH/common/common/src/main/res/layout/common_order_status_view.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/TaxiUnmannedDriverProvider.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/TaxiUnmannedDriverProvider.kt index 2364dcf294..bf4001fb40 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/TaxiUnmannedDriverProvider.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/TaxiUnmannedDriverProvider.kt @@ -4,8 +4,10 @@ import android.content.Context import android.view.View import androidx.fragment.app.Fragment import com.alibaba.android.arouter.facade.annotation.Route +import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import com.mogo.och.common.module.biz.provider.CommonService import com.mogo.och.common.module.constant.OchCommonConst import com.mogo.och.common.module.biz.provider.CommonServiceImpl import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutopilotAnalytics @@ -46,9 +48,20 @@ class TaxiUnmannedDriverProvider : CommonServiceImpl() { } override fun createOchBusinessView(context: Context?): View? { + CallerLogger.d(SceneConstant.M_TAXI + tag, "createOchBusinessView") return context?.let { SwitchBizView(it) } } + companion object{ + fun getFragmentInfo():Fragment?{ + (ARouter.getInstance().build(OchCommonConst.TAXI_UNMANNED_DRIVER) + .navigation() as? CommonService)?.apply { + return getFragment() + } + return null + } + } + } \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwitchBizView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwitchBizView.kt index 0a991bb6f5..eace2154aa 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwitchBizView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwitchBizView.kt @@ -3,13 +3,21 @@ package com.mogo.och.unmanned.taxi.ui.bizswitch import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View +import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner +import com.mogo.commons.module.status.MogoStatusManager +import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.common.module.utils.FlowBus import com.mogo.och.common.module.utils.ResourcesUtils import com.mogo.och.common.module.wigets.WindowRelativeLayout import com.mogo.och.unmanned.taxi.R +import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst import kotlinx.android.synthetic.main.unmanned_switch_biz.view.loading_biz class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallback { @@ -30,16 +38,25 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac private var viewModel: SwtichBizeModel?=null + private var fragment: LifecycleOwner?=null + init { LayoutInflater.from(context).inflate(R.layout.unmanned_switch_biz, this, true) initView() + initEventBus() } private fun initView(){ + fragment = TaxiUnmannedDriverProvider.getFragmentInfo() loading_biz.setEmptyText(ResourcesUtils.getString(R.string.common_biz_loading)) } + private fun initEventBus() { + + } + + override fun onAttachedToWindow() { super.onAttachedToWindow() viewModel = findViewTreeViewModelStoreOwner()?.let { @@ -54,48 +71,6 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac override fun showLoadingView(){ startLoading = System.currentTimeMillis() loading_biz.visibility = GONE - - } - - - /** - * 初始化数据 - */ - override fun loadLineData() { - - } - - - // 展示选择任务页面 - override fun showSwitchTaskInfo() { - val endLoading = System.currentTimeMillis() - - val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0 - CallerLogger.d(TAG,"展示任务 lading 展示了 ${dex}毫秒") - - ThreadUtils.runOnUiThreadDelayed({ - loading_biz.visibility = GONE - },dex,ThreadUtils.MODE.QUEUE) - } - - // 展示选择线路页面 - override fun showSwtichLineView() { - val endLoading = System.currentTimeMillis() - val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0 - CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒") - ThreadUtils.runOnUiThreadDelayed({ - loading_biz.visibility = GONE - },dex,ThreadUtils.MODE.QUEUE) - - } - // 展示正在进行的任务 - override fun loadRunningTask() { - val endLoading = System.currentTimeMillis() - val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0 - CallerLogger.d(TAG,"展示运行中任务 lading 展示了 ${dex}毫秒") - ThreadUtils.runOnUiThreadDelayed({ - loading_biz.visibility = GONE - },dex,ThreadUtils.MODE.QUEUE) } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwtichBizeModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwtichBizeModel.kt index 6117199ee5..a5bc332af2 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwtichBizeModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/bizswitch/SwtichBizeModel.kt @@ -1,6 +1,7 @@ package com.mogo.och.unmanned.taxi.ui.bizswitch import androidx.lifecycle.ViewModel +import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel /** * @author XuXinChao @@ -18,17 +19,17 @@ class SwtichBizeModel : ViewModel() { } + fun changeOperationStatus(){ + TaxiTaskModel.updateCarServingStatus() + } + fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { this.viewCallback = viewCallback this.viewCallback?.showLoadingView() } interface SwtichLineViewCallback { - fun showSwtichLineView() fun showLoadingView() - fun showSwitchTaskInfo() - fun loadLineData() - fun loadRunningTask() } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchModel.kt new file mode 100644 index 0000000000..1450f2e22d --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchModel.kt @@ -0,0 +1,33 @@ +package com.mogo.och.unmanned.taxi.ui.task + +import androidx.lifecycle.ViewModel + +/** + * @author XuXinChao + * @description BadCase录包管理页面 + * @since: 2022/12/15 + */ +class ItinerarySwitchModel : ViewModel() { + + private val TAG = ItinerarySwitchModel::class.java.simpleName + + private var viewCallback: SwtichLineViewCallback? = null + + + override fun onCleared() { + + } + + fun changeOperationStatus(){ + TaxiTaskModel.updateCarServingStatus() + } + + fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { + this.viewCallback = viewCallback + } + + interface SwtichLineViewCallback { + + } +} + diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchView.kt new file mode 100644 index 0000000000..7c609145ac --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/ItinerarySwitchView.kt @@ -0,0 +1,108 @@ +package com.mogo.och.unmanned.taxi.ui.task + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner +import com.mogo.commons.module.status.MogoStatusManager +import com.mogo.eagle.core.utilcode.kotlin.onClick +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.common.module.utils.FlowBus +import com.mogo.och.common.module.utils.ResourcesUtils +import com.mogo.och.unmanned.taxi.R +import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst +import com.mogo.och.unmanned.taxi.wigets.TaxiSelectViewGroup +import kotlinx.android.synthetic.main.unmanned_switch_itinerary.view.currentItinerary +import kotlinx.android.synthetic.main.unmanned_switch_itinerary.view.nextItinerary +import kotlinx.android.synthetic.main.unmanned_switch_itinerary.view.order_operation_change +import kotlinx.android.synthetic.main.unmanned_switch_itinerary.view.taxiServerSelector + +class ItinerarySwitchView: ConstraintLayout, ItinerarySwitchModel.SwtichLineViewCallback { + + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + + companion object { + const val TAG = "SwitchBizView" + } + + private var viewModel: ItinerarySwitchModel?=null + + private var fragment: LifecycleOwner?=null + + + init { + LayoutInflater.from(context).inflate(R.layout.unmanned_switch_itinerary, this, true) + initView() + initEventBus() + } + + private fun initView(){ + fragment = TaxiUnmannedDriverProvider.getFragmentInfo() + order_operation_change.onClick { + if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) { + ToastUtils.showLong("退出验证模式后再接单吧") + return@onClick + } + viewModel?.changeOperationStatus() + } + taxiServerSelector.checkChangeListener = object : TaxiSelectViewGroup.CheckChangeListener{ + override fun changeCheck(newCheck: TaxiSelectViewGroup.ServerType?) { + when (newCheck) { + TaxiSelectViewGroup.ServerType.currentItinerary -> { + currentItinerary.visibility = View.VISIBLE + nextItinerary.visibility = View.GONE + } + TaxiSelectViewGroup.ServerType.nextItinerary -> { + currentItinerary.visibility = View.GONE + nextItinerary.visibility = View.VISIBLE + } + else ->{ + currentItinerary.visibility = View.GONE + nextItinerary.visibility = View.GONE + } + } + } + + } + } + + private fun initEventBus() { + fragment?.let { + FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT) + .register(it) { show -> + taxiServerSelector.setNextItineraryRedBagVisable( if (show) View.VISIBLE else View.GONE) + } +// FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED) +// .register(it) { taskWithOrder -> +// nextTaskFragment?.onTaskDataChanged(taskWithOrder) +// } + } + + } + + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(ItinerarySwitchModel::class.java) + } + viewModel?.setDistanceCallback(this) + } + + +} diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt new file mode 100644 index 0000000000..52bc9237a1 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt @@ -0,0 +1,29 @@ +package com.mogo.och.unmanned.taxi.ui.itinerarycurrent + +import androidx.lifecycle.ViewModel + +/** + * @author XuXinChao + * @description BadCase录包管理页面 + * @since: 2022/12/15 + */ +class ItineraryCurrentModel : ViewModel() { + + private val TAG = ItineraryCurrentModel::class.java.simpleName + + private var viewCallback: SwtichLineViewCallback? = null + + + override fun onCleared() { + + } + + fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { + this.viewCallback = viewCallback + } + + interface SwtichLineViewCallback { + + } +} + diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt new file mode 100644 index 0000000000..c43a3f0d3d --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt @@ -0,0 +1,53 @@ +package com.mogo.och.unmanned.taxi.ui.task.itinerarycurrent + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner +import com.mogo.och.unmanned.taxi.R +import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.ui.itinerarycurrent.ItineraryCurrentModel + +class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback { + + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + + companion object { + const val TAG = "SwitchBizView" + } + + private var viewModel: ItineraryCurrentModel?=null + + private var fragment: LifecycleOwner?=null + + + init { + LayoutInflater.from(context).inflate(R.layout.unmanned_itinerary_current, this, true) + initView() + } + + private fun initView(){ + fragment = TaxiUnmannedDriverProvider.getFragmentInfo() + } + + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(ItineraryCurrentModel::class.java) + } + viewModel?.setDistanceCallback(this) + } + +} diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextModel.kt new file mode 100644 index 0000000000..2f93c8d360 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextModel.kt @@ -0,0 +1,29 @@ +package com.mogo.och.unmanned.taxi.ui.itinerarynext + +import androidx.lifecycle.ViewModel + +/** + * @author XuXinChao + * @description BadCase录包管理页面 + * @since: 2022/12/15 + */ +class ItineraryNextModel : ViewModel() { + + private val TAG = ItineraryNextModel::class.java.simpleName + + private var viewCallback: SwtichLineViewCallback? = null + + + override fun onCleared() { + + } + + fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { + this.viewCallback = viewCallback + } + + interface SwtichLineViewCallback { + + } +} + diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt new file mode 100644 index 0000000000..964d18fa25 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt @@ -0,0 +1,54 @@ +package com.mogo.och.unmanned.taxi.ui.task.itinerarynext + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner +import com.mogo.och.common.module.wigets.WindowRelativeLayout +import com.mogo.och.unmanned.taxi.R +import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.ui.itinerarynext.ItineraryNextModel + +class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCallback { + + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + + companion object { + const val TAG = "SwitchBizView" + } + + private var viewModel: ItineraryNextModel?=null + + private var fragment: LifecycleOwner?=null + + + init { + LayoutInflater.from(context).inflate(R.layout.unmanned_itinerary_next, this, true) + initView() + } + + private fun initView() { + fragment = TaxiUnmannedDriverProvider.getFragmentInfo() + } + + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it)[ItineraryNextModel::class.java] + } + viewModel?.setDistanceCallback(this) + } + +} diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectView.kt index ba227db631..5c268e7dd1 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectView.kt @@ -1,16 +1,16 @@ package com.mogo.och.unmanned.taxi.wigets import android.content.Context -import android.content.res.TypedArray import android.util.AttributeSet import android.view.LayoutInflater import androidx.constraintlayout.widget.ConstraintLayout -import androidx.core.content.ContextCompat +import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.map.listener.IMogoMapListener import com.mogo.och.unmanned.taxi.R import kotlinx.android.synthetic.main.taxi_select_view.view.aciv_check_state import kotlinx.android.synthetic.main.taxi_select_view.view.actv_server_name +import kotlinx.android.synthetic.main.taxi_select_view.view.wait_order_num class TaxiSelectView @JvmOverloads constructor( context: Context, @@ -23,6 +23,8 @@ class TaxiSelectView @JvmOverloads constructor( private lateinit var taxiServerTitle:String + var checkChangeListener:CheckChangeListener?=null + init { LayoutInflater.from(context).inflate(R.layout.taxi_select_view, this, true) try { @@ -39,19 +41,28 @@ class TaxiSelectView @JvmOverloads constructor( super.onAttachedToWindow() CallerLogger.d(TAG,"onAttachedToWindow") actv_server_name.text = taxiServerTitle - actv_server_name.setOnCheckedChangeListener { buttonView, isChecked -> - if(buttonView.id==R.id.actv_server_name){ - if(isChecked){ - aciv_check_state.visibility = VISIBLE - }else{ - aciv_check_state.visibility = GONE - } + + onClick { + if (actv_server_name.isChecked) { + return@onClick + }else{ + actv_server_name.isChecked = true + aciv_check_state.visibility = VISIBLE + checkChangeListener?.onCheckChangeListener(actv_server_name.isChecked) } } } fun setCheck(isCheck:Boolean){ - actv_server_name.isChecked = isCheck + if (isCheck) { + actv_server_name.isChecked = true + aciv_check_state.visibility = VISIBLE + checkChangeListener?.onCheckChangeListener(actv_server_name.isChecked) + }else{ + actv_server_name.isChecked = false + aciv_check_state.visibility = GONE + checkChangeListener?.onCheckChangeListener(actv_server_name.isChecked) + } } override fun onVisibilityAggregated(isVisible: Boolean) { @@ -69,6 +80,13 @@ class TaxiSelectView @JvmOverloads constructor( CallerLogger.d(TAG,"onDetachedFromWindow") } + fun setRedBagVisable(visibility: Int) { + wait_order_num.visibility = visibility + } + + interface CheckChangeListener{ + fun onCheckChangeListener(isCheck: Boolean) + } } \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt new file mode 100644 index 0000000000..9c04f15962 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt @@ -0,0 +1,90 @@ +package com.mogo.och.unmanned.taxi.wigets + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.map.listener.IMogoMapListener +import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager.M_LISTENERS +import com.mogo.och.unmanned.taxi.R +import kotlinx.android.synthetic.main.taxi_select_view_group.view.textCurrentItinerary +import kotlinx.android.synthetic.main.taxi_select_view_group.view.textNextItinerary +import kotlin.properties.Delegates + +class TaxiSelectViewGroup @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener { + companion object { + const val TAG = "LoadingMapStatusView" + } + + private var checkType:ServerType? by Delegates.observable(null) { _, oldValue, newValue -> + if (oldValue != newValue) { + checkChangeListener?.changeCheck(newValue) + } + } + var checkChangeListener:CheckChangeListener?=null + + init { + LayoutInflater.from(context).inflate(R.layout.taxi_select_view_group, this, true) + initView() + } + + private fun initView() { + textCurrentItinerary.checkChangeListener = object : TaxiSelectView.CheckChangeListener{ + override fun onCheckChangeListener(isCheck: Boolean) { + if(isCheck){ + checkType = ServerType.currentItinerary + textNextItinerary.setCheck(false) + } + } + } + textNextItinerary.checkChangeListener = object : TaxiSelectView.CheckChangeListener{ + override fun onCheckChangeListener(isCheck: Boolean) { + if(isCheck){ + checkType = ServerType.nextItinerary + textCurrentItinerary.setCheck(false) + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerLogger.d(TAG,"onAttachedToWindow") + } + + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(isVisible){ + + }else{ + + } + } + + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerLogger.d(TAG,"onDetachedFromWindow") + } + + fun setNextItineraryRedBagVisable(visibility: Int) { + textNextItinerary.setRedBagVisable(visibility) + } + + enum class ServerType{ + currentItinerary, + nextItinerary + } + + interface CheckChangeListener{ + fun changeCheck(newCheck:ServerType?) + } + + +} \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_new_message.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_new_message.png new file mode 100755 index 0000000000..5743583744 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_new_message.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_close.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_close.png new file mode 100755 index 0000000000..0b10612907 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_close.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_end_station_point.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_end_station_point.png new file mode 100755 index 0000000000..dfa74f0a44 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_end_station_point.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_start_station_point.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_start_station_point.png new file mode 100755 index 0000000000..62ec826abb Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_current_start_station_point.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_end_station_point.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_end_station_point.png new file mode 100755 index 0000000000..1eca96d541 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_end_station_point.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_exercise.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_exercise.png new file mode 100755 index 0000000000..12542d0bec Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_exercise.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_nav.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_nav.png new file mode 100755 index 0000000000..7d901eb1d3 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_nav.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_order.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_order.png new file mode 100755 index 0000000000..8022b12092 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_order.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_start_station_point.png b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_start_station_point.png new file mode 100755 index 0000000000..b2c4edba60 Binary files /dev/null and b/OCH/taxi/unmanned-driver/src/main/res/drawable-nodpi/taxi_task_start_station_point.png differ diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_default.xml b/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_default.xml new file mode 100644 index 0000000000..33cd161e8c --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_default.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_order_count.xml b/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_order_count.xml new file mode 100644 index 0000000000..190dd17629 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/drawable/shape_itinerary_bg_order_count.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view.xml index ddf43327bb..0b5cc90041 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view.xml @@ -17,11 +17,11 @@ app:layout_constraintBottom_toBottomOf="parent" android:src="@drawable/taxi_selected_head" /> - + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view_group.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view_group.xml new file mode 100644 index 0000000000..b2935175a7 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_select_view_group.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml new file mode 100644 index 0000000000..fd6679d196 --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml new file mode 100644 index 0000000000..52d197d77d --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_biz.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_biz.xml index aa6dc4acf4..d1053f5c78 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_biz.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_biz.xml @@ -20,6 +20,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"/> + + + - - - - \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml new file mode 100644 index 0000000000..2c807a6f4e --- /dev/null +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml b/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml index 177f69f99e..0ce09bc38c 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml @@ -35,4 +35,6 @@ #CCB9C3E9 #2EACFF #4Dffffff + #4D000000 + #CCCCCC \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt index 9c9dcac4e8..34f1fc6804 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt @@ -39,6 +39,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.JsonParser import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils @@ -110,6 +111,9 @@ class FaultReasonView @JvmOverloads constructor( private val type = 1 //故障类接口请求Type值为1 + private val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand) + private val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract) + init { LayoutInflater.from(context).inflate(R.layout.view_fault_reason, this, true) initView() @@ -166,9 +170,7 @@ class FaultReasonView @JvmOverloads constructor( @SuppressLint("SetTextI18n") private fun initEvent() { CallerDevaToolsListenerManager.addListener(TAG, this) - val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand) iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight) - val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract) iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight) //获取一级分类 CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0) @@ -300,53 +302,57 @@ class FaultReasonView @JvmOverloads constructor( } //上报 tvFaultReport.setOnClickListener { - if (level2Name.isEmpty()) { - ToastUtils.showShort("请完整填写再上报") - return@setOnClickListener - } - if (hasLevel3 && level3Name.isEmpty()) { - ToastUtils.showShort("请完整填写再上报") - return@setOnClickListener - } - reportNote = etNoteInput.text.toString() - //故障码列表赋值 - BadCaseConfig.newFMInfoMsg?.fmInfoList?.forEach { - faultCodeList.add(it.faultId) - } - val geocodeSearch = GeocodeSearch(context) - geocodeSearch.setOnGeocodeSearchListener(object : - GeocodeSearch.OnGeocodeSearchListener { - override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { - regeocodeResult?.regeocodeAddress?.formatAddress?.let { - address = it - } - val padProblemList = ArrayList() - val note = if (reportNote.isEmpty()) { - "$level1Name-$level2Name-$level3Name" - } else { - "$level1Name-$level2Name-$level3Name($reportNote)" - } - val padProblemInfo = PadProblemInfo( - address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id, - level2Id, level3Id, BadCaseConfig.lineName, note, reportType, - SharedPrefsMgr.getInstance().getString("och_account", "") - ) - padProblemList.add(padProblemInfo) - val padAddProblemReq = - PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber) - CallerDevaToolsManager.problemPadAdd(padAddProblemReq) + if(ClickUtils.isFastClick()){ + if (level2Name.isEmpty()) { + ToastUtils.showShort("请完整填写再上报") + return@setOnClickListener } - - override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { - + if (hasLevel3 && level3Name.isEmpty()) { + ToastUtils.showShort("请完整填写再上报") + return@setOnClickListener } - }) - val latLon = LatLonPoint( - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude - ) - val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP) - geocodeSearch.getFromLocationAsyn(q) + reportNote = etNoteInput.text.toString() + //故障码列表赋值 + BadCaseConfig.newFMInfoMsg?.fmInfoList?.forEach { + faultCodeList.add(it.faultId) + } + val geocodeSearch = GeocodeSearch(context) + geocodeSearch.setOnGeocodeSearchListener(object : + GeocodeSearch.OnGeocodeSearchListener { + override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { + regeocodeResult?.regeocodeAddress?.formatAddress?.let { + address = it + } + val padProblemList = ArrayList() + val note = if (reportNote.isEmpty()) { + "$level1Name-$level2Name-$level3Name" + } else { + "$level1Name-$level2Name-$level3Name($reportNote)" + } + val padProblemInfo = PadProblemInfo( + address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id, + level2Id, level3Id, BadCaseConfig.lineName, note, reportType, + SharedPrefsMgr.getInstance().getString("och_account", "") + ) + padProblemList.add(padProblemInfo) + val padAddProblemReq = + PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber) + CallerDevaToolsManager.problemPadAdd(padAddProblemReq) + } + + override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { + + } + }) + val latLon = LatLonPoint( + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude + ) + val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP) + geocodeSearch.getFromLocationAsyn(q) + }else{ + ToastUtils.showShort("请勿连续上报,稍后再试") + } } //取消 @@ -531,4 +537,34 @@ class FaultReasonView @JvmOverloads constructor( ToastUtils.showShort("故障列表获取失败:$msg") } + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(visibility == View.VISIBLE){ + //弹窗展示时间 + tvFaultTime.text = + millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat()) + //故障发生时间 + workOrderOccurrenceTime = System.currentTimeMillis() + tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat()) + //关闭故障类型选择 + faultTypeSelectStatus = false + tvFaultType.setCompoundDrawables(null, null, iconDown, null) + //关闭故障原因选择 + faultReasonSelectStatus = false + tvFaultReason.setCompoundDrawables(null, null, iconDown, null) + //隐藏列表 + rvFaultList.visibility = View.GONE + //补充描述 + etNoteInput.setText("") + //问题描述录音 + ivNoteAudio.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_reason_audio_normal + ) + ) + setAudio(false) + } + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/WorkOrderView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/WorkOrderView.kt index d47ece024e..7c848cbc3c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/WorkOrderView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/WorkOrderView.kt @@ -13,6 +13,7 @@ import android.view.animation.Animation import android.view.animation.ScaleAnimation import android.widget.EditText import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat import com.iflytek.cloud.ErrorCode import com.iflytek.cloud.InitListener import com.iflytek.cloud.RecognizerListener @@ -31,6 +32,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManage import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.JsonParser import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils @@ -159,41 +161,59 @@ class WorkOrderView @JvmOverloads constructor( //问题描述录音 iv_describe_audio.setOnClickListener { audioStatus = !audioStatus + if (audioStatus) { + iv_describe_audio.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_reason_audio_pressed + ) + ) + } else { + iv_describe_audio.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_reason_audio_normal + ) + ) + } setAudio(audioStatus) } //上报 tv_work_order_report.setOnClickListener { - //工单问题类型必选,没有选择,进行提示 - if(workOrderType.isEmpty()){ - ToastUtils.showShort("请选择问题类型") - return@setOnClickListener - } - if(et_describe_input.text.toString().isEmpty()){ - ToastUtils.showShort("请填写问题描述") - return@setOnClickListener - } - GlobalScope.launch(Dispatchers.IO){ - val msgBoxList = CallerMsgBoxManager.queryFMInfoList(context, - workOrderOccurrenceTime-120000,workOrderOccurrenceTime+120000) - val faultList = ArrayList() - msgBoxList?.forEach { msgBoxBean -> - val fmInfoMsg = msgBoxBean.bean as FMInfoMsg - fmInfoMsg.fmInfoList?.forEach { fault -> - val faultBean = FaultInfo(false,fault.faultId,fault.faultName, - fault.faultTime.toString(), FaultDetailInfo(fault.faultDesc) - ) - faultList.add(faultBean) - } + if(ClickUtils.isFastClick()){ + //工单问题类型必选,没有选择,进行提示 + if(workOrderType.isEmpty()){ + ToastUtils.showShort("请选择问题类型") + return@setOnClickListener } - val workOrderReportInfo = WorkOrderReportInfo(workOrderType,workOrderOccurrenceTime.toString(), - et_describe_input.text.toString(), CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude.toString(), - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude.toString(), - AppConfigInfo.plateNumber, SharedPrefsMgr.getInstance().getString("och_account","") , - BadCaseConfig.dockerVersion ?:"",faultList) - CallerDevaToolsManager.workOrderReport(workOrderReportInfo) + if(et_describe_input.text.toString().isEmpty()){ + ToastUtils.showShort("请填写问题描述") + return@setOnClickListener + } + GlobalScope.launch(Dispatchers.IO){ + val msgBoxList = CallerMsgBoxManager.queryFMInfoList(context, + workOrderOccurrenceTime-120000,workOrderOccurrenceTime+120000) + val faultList = ArrayList() + msgBoxList?.forEach { msgBoxBean -> + val fmInfoMsg = msgBoxBean.bean as FMInfoMsg + fmInfoMsg.fmInfoList?.forEach { fault -> + val faultBean = FaultInfo(false,fault.faultId,fault.faultName, + fault.faultTime.toString(), FaultDetailInfo(fault.faultDesc) + ) + faultList.add(faultBean) + } + } + val workOrderReportInfo = WorkOrderReportInfo(workOrderType,workOrderOccurrenceTime.toString(), + et_describe_input.text.toString(), CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude.toString(), + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude.toString(), + AppConfigInfo.plateNumber, SharedPrefsMgr.getInstance().getString("och_account","") , + BadCaseConfig.dockerVersion ?:"",faultList) + CallerDevaToolsManager.workOrderReport(workOrderReportInfo) + } + }else{ + ToastUtils.showShort("请勿连续上报,稍后再试") } - } //取消 @@ -321,4 +341,28 @@ class WorkOrderView @JvmOverloads constructor( this.clickListener = clickListener } + override fun onVisibilityChanged(changedView: View, visibility: Int) { + super.onVisibilityChanged(changedView, visibility) + if(visibility == View.VISIBLE){ + //弹窗展示时间 + tv_work_order_time.text = + millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat()) + //问题类型 + wrap_radio_group.clearCheck() + //发生时间 + workOrderOccurrenceTime = System.currentTimeMillis() + tv_occurrence_time.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat()) + et_describe_input.setText("") + //问题描述录音 + iv_describe_audio.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_reason_audio_normal + ) + ) + setAudio(false) + } + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt index b9343903f9..dd3966d056 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/OperatePanelLayout.kt @@ -19,6 +19,7 @@ import androidx.preference.SwitchPreferenceCompat import androidx.preference.TwoStatePreference import androidx.preference.forEach import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.multidisplay.TelematicConstant @@ -52,6 +53,7 @@ import com.mogo.eagle.core.function.hmi.ui.utils.SOPAnalyticsManager.clickEventA import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration import com.mogo.eagle.core.utilcode.util.AppStateManager @@ -960,7 +962,12 @@ class OperatePanelLayout : LinearLayout { private const val KEY_OVERTAKE_SPEED_THRESHOLDSS = "overtake_speed_thresholds" } + private var prevCheckedKeyForFusionMode: String? = null + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + if (AppConfigInfo.isConnectAutopilot) { + CallerAutoPilotControlManager.getCarConfig() + } CallerAutopilotCarConfigListenerManager.addListener(TAG, this) CallerSopSettingManager.addListener(TAG, this) CallerHmiViewControlListenerManager.addListener(TAG, this) @@ -1038,19 +1045,39 @@ class OperatePanelLayout : LinearLayout { return FunctionBuildConfig.isFaultSlowDown } KEY_ALL_MERGE_MODE -> { - return FunctionBuildConfig.fusionMode == 1 + val checked = FunctionBuildConfig.fusionMode == 1 + if (checked) { + prevCheckedKeyForFusionMode = KEY_ALL_MERGE_MODE + } + return checked } KEY_BLIND_AREA_MODE -> { - return FunctionBuildConfig.fusionMode == 2 + val checked = FunctionBuildConfig.fusionMode == 2 + if (checked) { + prevCheckedKeyForFusionMode = KEY_BLIND_AREA_MODE + } + return checked } KEY_BEYOND_VISUAL_RANGE_MODE -> { - return FunctionBuildConfig.fusionMode == 3 + val checked = FunctionBuildConfig.fusionMode == 3 + if (checked) { + prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE + } + return checked } KEY_TRANSPARENT_TRANSFER_MODE -> { - return FunctionBuildConfig.fusionMode == 4 + val checked = FunctionBuildConfig.fusionMode == 4 + if (checked) { + prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE + } + return checked } KEY_PURE_OBU_MODE -> { - return FunctionBuildConfig.fusionMode == 5 + val checked = FunctionBuildConfig.fusionMode == 5 + if (checked) { + prevCheckedKeyForFusionMode = KEY_PURE_OBU_MODE + } + return checked } KEY_AUTO_PILOT_SPEED_THRESHOLDS -> { return listOf("0.0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5.0") @@ -1066,10 +1093,11 @@ class OperatePanelLayout : LinearLayout { } override fun onPreferenceClick(preference: Preference): Boolean { - Log.d(TAG, "-- onPreferenceClick --:pref -> $preference") + Logger.d(TAG, "-- onPreferenceClick --:pref -> ${preference.key}") when (preference.key) { KEY_AUTO_PILOT_SPEED_THRESHOLDS -> { - FunctionBuildConfig.maxSpeedLimit = preference.extras.getDouble(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.maxSpeedLimit) + val currentValue = preference.extras.getDouble(PreferenceWithSpeedSetting.KEY_BUNDLE_CURRENT_VALUE, FunctionBuildConfig.maxSpeedLimit) + FunctionBuildConfig.maxSpeedLimit = currentValue val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(FunctionBuildConfig.maxSpeedLimit.toInt()) when { isSuccess -> { @@ -1180,39 +1208,84 @@ class OperatePanelLayout : LinearLayout { return true } KEY_ALL_MERGE_MODE -> { - FunctionBuildConfig.fusionMode = 1 - hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) - clickEventAnalytics("融合模式", true) - CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) - return true + val isChecked = newValue as? Boolean ?: false + if (isChecked) { + FunctionBuildConfig.fusionMode = 1 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_ALL_MERGE_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_ALL_MERGE_MODE + changeValue(it, false) + } + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) + clickEventAnalytics("融合模式", true) + CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) + } + return isChecked } KEY_BLIND_AREA_MODE -> { - FunctionBuildConfig.fusionMode = 2 - hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) - clickEventAnalytics("融合模式", true) - CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) - return true + val isChecked = newValue as? Boolean ?: false + if (isChecked) { + FunctionBuildConfig.fusionMode = 2 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_BLIND_AREA_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_BLIND_AREA_MODE + changeValue(it, false) + } + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) + clickEventAnalytics("融合模式", true) + CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) + } + return isChecked } KEY_BEYOND_VISUAL_RANGE_MODE -> { - FunctionBuildConfig.fusionMode = 3 - hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) - clickEventAnalytics("融合模式", true) - CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) - return true + val isChecked = newValue as? Boolean ?: false + if (isChecked) { + FunctionBuildConfig.fusionMode = 3 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_BEYOND_VISUAL_RANGE_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE + changeValue(it, false) + } + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) + clickEventAnalytics("融合模式", true) + CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) + } + return isChecked } KEY_TRANSPARENT_TRANSFER_MODE -> { - FunctionBuildConfig.fusionMode = 4 - hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) - clickEventAnalytics("融合模式", true) - CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) - return true + val isChecked = newValue as? Boolean ?: false + if (isChecked) { + FunctionBuildConfig.fusionMode = 4 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_TRANSPARENT_TRANSFER_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE + changeValue(it, false) + } + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) + clickEventAnalytics("融合模式", true) + CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) + } + return isChecked } KEY_PURE_OBU_MODE -> { - FunctionBuildConfig.fusionMode = 5 - hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) - clickEventAnalytics("融合模式", true) - CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) - return true + val isChecked = newValue as? Boolean ?: false + if (isChecked) { + FunctionBuildConfig.fusionMode = 5 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_PURE_OBU_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_PURE_OBU_MODE + changeValue(it, false) + } + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) + clickEventAnalytics("融合模式", true) + CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) + } + return isChecked } } return super.onPreferenceChange(preference, newValue) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml index b5e58fd049..6a48deb66b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml @@ -4,131 +4,122 @@ android:layout_width="@dimen/dp_960" android:layout_height="match_parent"> - + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - + - + - - - - - + app:layout_constraintLeft_toLeftOf="parent" + /> - + - + - + - - + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml index 2e93918dc9..4315bbcaff 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml @@ -94,7 +94,7 @@ app:layout_constraintTop_toBottomOf="@id/tvFaultType" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="@dimen/dp_103" - android:layout_marginTop="@dimen/dp_30" + android:layout_marginTop="@dimen/dp_33" /> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/xml/operate_panel_preference_headers.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/xml/operate_panel_preference_headers.xml index dc020a7d7a..9d3a450447 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/xml/operate_panel_preference_headers.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/xml/operate_panel_preference_headers.xml @@ -31,10 +31,10 @@ android:key="mofang" android:layout="@layout/layout_operate_panel_preference_header" android:title="蘑方" /> - + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt index e1c095aa4a..d37a500d9c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt @@ -227,6 +227,7 @@ class TravelRealityView @JvmOverloads constructor( @Volatile private var isSmallMap: Boolean = true private var iconRes = R.drawable.small_map_car + @Volatile private var globalPathResp: MessagePad.GlobalPathResp? = null private val mCoordinatesLatLng: MutableList = ArrayList() private var mSmallCarMarker: Marker? = null @@ -324,13 +325,22 @@ class TravelRealityView @JvmOverloads constructor( } // 显示小地图样式 changeMapSettings(true) + globalPathResp?.let { + if (it.wayPointsList.size > 0) { + drawRotting() + } + } } else { clearPolyline() hideSmallCarMarker() // 显示行程总览地图样式 changeMapSettings(false) + val globalPath = reqData + if (!globalPath.isNullOrEmpty()) { + requestData(globalPath as ArrayList) + } if (!isRoadTrackReq) { - handleRoadTrajectories(roadTrackList, null) + handleRoadTrajectories(roadTrackList, globalPath) } } } @@ -559,10 +569,6 @@ class TravelRealityView @JvmOverloads constructor( super.onVisibilityChanged(changedView, visibility) if (visibility == VISIBLE) { Log.d(TAG, "onVisibilityChanged:VISIBLE!") - val globalPath: List? = reqData - if (!globalPath.isNullOrEmpty()) { - requestData(globalPath as ArrayList) - } } } @@ -585,6 +591,7 @@ class TravelRealityView @JvmOverloads constructor( // 注册定位监听 CallerChassisLocationGCJ02ListenerManager.removeListener("${TAG}${this.hashCode()}") CallerPlanningRottingListenerManager.removeListener("${TAG}${this.hashCode()}") + CallerAutoPilotStatusListenerManager.removeListener("${TAG}${this.hashCode()}") nonFrequentHandler?.looper?.quitSafely() nonFrequentHandler = null travelNetWorkModel.cancelAllRequest() @@ -1446,6 +1453,16 @@ class TravelRealityView @JvmOverloads constructor( } } + override fun onAutopilotRouteLineId(lineId: Long) { + super.onAutopilotRouteLineId(lineId) + if (lineId == 0L) { + this.globalPathResp = null + UiThreadHandler.post { + clearPolyline() + } + } + } + private fun drawRotting() { globalPathResp?.let { val latLngList: MutableList = ArrayList() diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt index be3164e6b4..3e842deeac 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt @@ -29,7 +29,6 @@ object CallerAutopilotCarConfigListenerManager : CallerBase