[Taxi无人化] refactor: 抽取 base / debug view;
This commit is contained in:
@@ -8,7 +8,7 @@ import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.step
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.ui.TaxiFragment
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface ITaxiADASStatusCallback {
|
||||
void onAutopilotRunning();
|
||||
|
||||
//人机共驾
|
||||
void onManMachineCoDriving();
|
||||
void onParallelDrivingStatus();
|
||||
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.net.ConnectivityManager
|
||||
import android.text.TextUtils
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
@@ -32,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.addListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
@@ -833,7 +833,7 @@ object TaxiModel {
|
||||
return
|
||||
}
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback!!.onManMachineCoDriving()
|
||||
mADASStatusCallback!!.onParallelDrivingStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.mogo.och.taxi.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
|
||||
@@ -9,10 +9,10 @@ import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.amap.api.navi.model.NaviLatLng
|
||||
import com.elegant.utils.DateTimeUtils
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIC
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.overlay.core.Level
|
||||
@@ -45,6 +46,7 @@ import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_START_MAP_MAK
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TYPE_MARKER_TAXI_ORDER
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import com.mogo.och.taxi.model.TaxiUnmannedViewModel
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskAndOrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
import kotlinx.android.synthetic.main.taxi_no_data_common_view.noOrderDataTv
|
||||
@@ -520,7 +522,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
naviToEnd.visibility = View.GONE
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
mTaxiFragment?.showAmapNaviToStationFragment(false)
|
||||
mTaxiFragment?.showRottingToStationFragment(false)
|
||||
mTaxiFragment?.showRoutingToStationFragment(false)
|
||||
}
|
||||
|
||||
private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) {
|
||||
@@ -543,7 +545,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
naviToEnd.visibility = View.GONE
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
mTaxiFragment?.showAmapNaviToStationFragment(false)
|
||||
mTaxiFragment?.showRottingToStationFragment(false)
|
||||
mTaxiFragment?.showRoutingToStationFragment(false)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,7 +553,6 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
* @param meters m
|
||||
* @param timeInSecond 秒
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateDistanceAndTime(meters: Long, timeInSecond: Long) {
|
||||
// CallerLogger.INSTANCE.d(M_TAXI + TAG,"meters = "+meters+"timeInSecond ="+timeInSecond);
|
||||
if (mCurrentTaskAndOrder!!.endSite == null && mCurrentUntruthTask == null) return
|
||||
@@ -572,7 +573,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
("<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> " + disUnit + "</font>"
|
||||
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + min + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>")
|
||||
|
||||
taskOtherInfo.text = Html.fromHtml(strHtml2,Html.FROM_HTML_MODE_LEGACY)
|
||||
taskOtherInfo.text = HtmlCompat.fromHtml(strHtml2, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
|
||||
private fun speekVoice200mTipsOnce() {
|
||||
@@ -731,7 +732,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
*/
|
||||
private fun initOrderTestBar() {
|
||||
taskStatus.setOnLongClickListener {
|
||||
mTaxiFragment?.clickTestBar()
|
||||
mTaxiFragment?.clickOrderDebugView()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.taxi.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
@@ -15,6 +14,7 @@ import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.endStationName
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.mBeingOrderLayout
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.naviToEnd
|
||||
@@ -24,7 +24,6 @@ import kotlinx.android.synthetic.main.unmanned_being_order.orderPhoneAndNum
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.startStationName
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskClickBtn
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskOtherInfo
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskStatus
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskTypeTv
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_tab
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_view_pager
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
@@ -158,7 +159,6 @@ class TaxiServerOrdersFragment : BaseFragment(){
|
||||
beingTaskFragment!!.onNaviToEndAmap(isShow)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun onCurrentOrderDistToEndChanged(meters: Long, timeInSecond: Long) {
|
||||
if (null == beingTaskFragment) return
|
||||
beingTaskFragment!!.updateDistanceAndTime(meters, timeInSecond)
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
package com.mogo.och.taxi.base
|
||||
package com.mogo.och.taxi.ui.base
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.SystemClock
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
@@ -71,12 +64,19 @@ import kotlin.math.abs
|
||||
*/
|
||||
abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V, P>(),
|
||||
IMogoMapListener, IMoGoAutopilotRecordListener {
|
||||
companion object {
|
||||
const val TAG = "BaseTaxiTabFragment"
|
||||
}
|
||||
|
||||
private val TAG = "BaseOchFragment"
|
||||
|
||||
// 高德导航fragment
|
||||
private var ochAmapNaviFragment: TaxiAmapNaviFragment? = null
|
||||
|
||||
// 高德地图轨迹展示fragment
|
||||
private var taxiRottingNaviFragment: TaxiRottingNaviFragment? = null
|
||||
|
||||
// 开发调试时展示信息德panel
|
||||
private var debugPanelView: View? = null
|
||||
|
||||
private val mHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
private val startAutopilotDrawableIds = arrayOf(
|
||||
@@ -139,7 +139,19 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
return R.layout.taxi_base_fragment
|
||||
}
|
||||
|
||||
private var panelView: View? = null
|
||||
fun showDebugPanel() {
|
||||
activity?.runOnUiThread {
|
||||
module_mogo_och_station_panel_container.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun hideDebugPanel() {
|
||||
activity?.runOnUiThread { module_mogo_och_station_panel_container.visibility = View.GONE }
|
||||
}
|
||||
|
||||
fun getDebugPanelView(): View? {
|
||||
return debugPanelView
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
override fun initViews() {
|
||||
@@ -184,7 +196,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
initBadCase(module_och_taxi_badcase_ll)
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
}
|
||||
panelView = LayoutInflater.from(context)
|
||||
debugPanelView = LayoutInflater.from(context)
|
||||
.inflate(getStationPanelViewId(), module_mogo_och_station_panel_container)
|
||||
module_mogo_och_autopilot_status.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
@@ -242,7 +254,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
module_mogo_och_operation_status.setOnClickListener { onChangeOperationStatus() }
|
||||
taxi_close_navi_icon.setOnClickListener {
|
||||
showAmapNaviToStationFragment(false)
|
||||
showRottingToStationFragment(false)
|
||||
showRoutingToStationFragment(false)
|
||||
}
|
||||
viewDriverMsgBoxButton.setClickListener(object : DriverMsgBoxButtonView.ClickListener {
|
||||
override fun showMsgBoxList(show: Boolean) {
|
||||
@@ -306,16 +318,16 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
override fun onDestroyView() {
|
||||
mapBizView.onDestroy()
|
||||
startAutopilotAnimationView.cancelCountdown()
|
||||
super.onDestroyView()
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
smallMapView.onDestroy()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private var mPrevAPStatus = -1
|
||||
private var mPreAutoPilotStatus = -1
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
@@ -328,7 +340,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
// 1. 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return@runOnUiThread
|
||||
}
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status && mPrevAPStatus != status
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status && mPreAutoPilotStatus != status
|
||||
) {
|
||||
// 2. 主动开启自动驾驶中,为2则停止loading,并isStarting = false
|
||||
startAutopilotDone(true)
|
||||
@@ -336,30 +348,40 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false)
|
||||
autopilotStatusAnimchanged(status)
|
||||
mPrevAPStatus = status
|
||||
updateAutopilotBtnByStatus(status)
|
||||
mPreAutoPilotStatus = status
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止【开启自动驾驶按钮】动画,并更新按钮状态
|
||||
*/
|
||||
fun stopAnimAndUpdateBtnStatus() {
|
||||
startOrStopLoadingAnim(false)
|
||||
startAutopilotDone(false)
|
||||
}
|
||||
|
||||
fun onManMachineCoDriving(manMachineCoDriving: Int) {
|
||||
if (mPrevAPStatus != manMachineCoDriving) {
|
||||
autopilotStatusAnimchanged(manMachineCoDriving)
|
||||
/**
|
||||
* 平行驾驶 【开启自动驾驶按钮】 更新
|
||||
*/
|
||||
fun onParallelDrivingStatus(parallelDrivingValue: Int) {
|
||||
if (mPreAutoPilotStatus != parallelDrivingValue) {
|
||||
updateAutopilotBtnByStatus(parallelDrivingValue)
|
||||
}
|
||||
mPrevAPStatus = manMachineCoDriving
|
||||
mPreAutoPilotStatus = parallelDrivingValue
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// TODO 确认
|
||||
fun updateCtvAutopilotStatusTag(tag: Boolean) {
|
||||
module_mogo_och_autopilot_status.tag = tag
|
||||
}
|
||||
|
||||
private var animatorDrawableUtil: AnimatorDrawableUtil? = null
|
||||
|
||||
private fun autopilotStatusAnimchanged(status: Int) {
|
||||
private fun updateAutopilotBtnByStatus(status: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
module_och_autopilot_tv.text = "自动驾驶"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
@@ -418,42 +440,10 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
animatorDrawableUtil!!.stop()
|
||||
anim_flow_iv.setImageResource(0)
|
||||
}
|
||||
|
||||
animatorDrawableUtil = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAutopilotDone(success: Boolean) {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
module_och_autopilot_iv.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
}
|
||||
if (success) {
|
||||
module_och_autopilot_tv.text = "成功"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_success)
|
||||
} else {
|
||||
module_och_autopilot_tv.text = "失败"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_failed)
|
||||
}
|
||||
mHandler.postDelayed({
|
||||
startOrStopLoadingAnim(false)
|
||||
onAutopilotStatusChanged(getState())
|
||||
}, 1000L)
|
||||
}
|
||||
|
||||
var isStarting = false
|
||||
private var autopilotLoadingAnimator: ObjectAnimator? = null
|
||||
|
||||
@@ -491,6 +481,37 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAutopilotDone(success: Boolean) {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
module_och_autopilot_iv.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
}
|
||||
if (success) {
|
||||
module_och_autopilot_tv.text = "成功"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_success)
|
||||
} else {
|
||||
module_och_autopilot_tv.text = "失败"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_failed)
|
||||
}
|
||||
mHandler.postDelayed({
|
||||
startOrStopLoadingAnim(false)
|
||||
onAutopilotStatusChanged(getState())
|
||||
}, 1000L)
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功10s后做处理
|
||||
@@ -507,19 +528,6 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}, TaxiUnmannedConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
fun hidPanel() {
|
||||
activity?.runOnUiThread { module_mogo_och_station_panel_container.visibility = View.GONE }
|
||||
}
|
||||
|
||||
fun showPanel() {
|
||||
activity?.runOnUiThread {
|
||||
module_mogo_och_station_panel_container.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun getPanelView(): View? {
|
||||
return panelView
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点面板view,在[.initViews]时候添加到container中
|
||||
@@ -533,7 +541,6 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
*/
|
||||
abstract fun startAutopilot()
|
||||
|
||||
|
||||
fun changeOperationViewVisible(visible: Int) {
|
||||
activity?.runOnUiThread(Runnable runOnUiThread@{
|
||||
if (module_mogo_och_operation_status == null) {
|
||||
@@ -549,17 +556,14 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode?) {
|
||||
//todo ui 切换
|
||||
}
|
||||
|
||||
fun showAmapNaviToStationFragment(isShow: Boolean) {
|
||||
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
|
||||
closeAmapViewIFHadeAdd()
|
||||
if (isShow) {
|
||||
closeRouteViewIFHadeAdd()
|
||||
// if (ochNaviFragment == null){
|
||||
closeRoutingViewIfHadAdd()
|
||||
ochAmapNaviFragment = TaxiAmapNaviFragment.newInstance()
|
||||
// }
|
||||
if (ochAmapNaviFragment!!.isAdded) {
|
||||
return
|
||||
}
|
||||
@@ -586,7 +590,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}
|
||||
}
|
||||
|
||||
private fun closeRouteViewIFHadeAdd() {
|
||||
private fun closeRoutingViewIfHadAdd() {
|
||||
if (taxiRottingNaviFragment != null) {
|
||||
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
|
||||
taxiRottingNaviFragment!!.onDestroy()
|
||||
@@ -596,13 +600,11 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
}
|
||||
}
|
||||
|
||||
fun showRottingToStationFragment(isShow: Boolean) {
|
||||
fun showRoutingToStationFragment(isShow: Boolean) {
|
||||
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
|
||||
if (isShow) {
|
||||
closeAmapViewIFHadeAdd()
|
||||
// if (ochNaviFragment == null){
|
||||
taxiRottingNaviFragment = TaxiRottingNaviFragment.newInstance()
|
||||
// }
|
||||
if (taxiRottingNaviFragment!!.isAdded) {
|
||||
return
|
||||
}
|
||||
@@ -613,7 +615,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
module_mogo_och_navi_panel_container.visibility = View.VISIBLE
|
||||
smallMapView.visibility = View.GONE
|
||||
} else {
|
||||
closeRouteViewIFHadeAdd()
|
||||
closeRoutingViewIfHadAdd()
|
||||
taxi_close_navi_icon.visibility = View.GONE
|
||||
module_mogo_och_navi_panel_container.visibility = View.GONE
|
||||
smallMapView.visibility = View.VISIBLE
|
||||
@@ -622,16 +624,18 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
|
||||
abstract fun startNaviToEndStation(isShow: Boolean)
|
||||
|
||||
fun showStartAutopilotBlinkAnimation(){
|
||||
fun showStartAutopilotBlinkAnimation() {
|
||||
startAutopilotAnimationView.show(
|
||||
StartAutopilotAnimationView.DirectionEnum.ALERT_WARNING_TOP,START_AUTOPILOT_ANIMATION_INTERVAL)
|
||||
StartAutopilotAnimationView.DirectionEnum.ALERT_WARNING_TOP,
|
||||
START_AUTOPILOT_ANIMATION_INTERVAL
|
||||
)
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
stopStartAutopilotBlinkAnimation()
|
||||
},START_AUTOPILOT_ANIMATION_INTERVAL)
|
||||
}, START_AUTOPILOT_ANIMATION_INTERVAL)
|
||||
}
|
||||
|
||||
private fun stopStartAutopilotBlinkAnimation(){
|
||||
private fun stopStartAutopilotBlinkAnimation() {
|
||||
startAutopilotAnimationView.dismiss(StartAutopilotAnimationView.DirectionEnum.ALERT_WARNING_TOP)
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,14 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
package com.mogo.och.taxi.ui.base
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
@@ -20,20 +17,16 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.LoginService
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseTaxiTabFragment
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import com.mogo.och.taxi.network.LoginBusImpl
|
||||
import com.mogo.och.taxi.presenter.TaxiPresenter
|
||||
import com.mogo.och.taxi.ui.ITaxiView
|
||||
import com.mogo.och.taxi.ui.TaxiPersonalDialogFragment
|
||||
import com.mogo.och.taxi.ui.TaxiServerOrdersFragment
|
||||
import com.mogo.och.taxi.utils.TPRouteDataTestUtils
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_operation_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_driver_role_tv
|
||||
import kotlinx.android.synthetic.main.taxi_panel.orderInfo
|
||||
import kotlinx.android.synthetic.main.taxi_panel.orderToStartLines
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskEndSite
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskStartSite
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskStatus2
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskType2
|
||||
import kotlinx.android.synthetic.main.taxi_panel.orderDebugView
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -45,10 +38,51 @@ import java.lang.ref.WeakReference
|
||||
*/
|
||||
class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
ITaxiView {
|
||||
private var serverOrdersFragmentWR: WeakReference<TaxiServerOrdersFragment>? = null
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaxiFragment"
|
||||
fun newInstance(): TaxiFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TaxiFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private var servedOrdersFragment: WeakReference<TaxiServerOrdersFragment>? = null
|
||||
private var personalDialogFragment: WeakReference<TaxiPersonalDialogFragment>? = null
|
||||
private var loginService: LoginService? = null
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(eventLogout: EventLogout) {
|
||||
if (eventLogout.messgae == EventLogout.LOGOUT_TYPE) {
|
||||
d(SceneConstant.M_TAXI + TAG, "changeOverview Event消息去登出")
|
||||
mPresenter.logout()
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun openOperationalInfoView(eventLogout: EventLogout) {
|
||||
// V6.0.0 临时注释,后台目前没有提供相应接口和数据来展示
|
||||
// if (eventLogout.messgae == EventLogout.PERSONAL_TYPE) {
|
||||
// 个人信息, 运营数据在无人化阶段暂时不展示
|
||||
// d(SceneConstant.M_TAXI + TAG, "openOperationalInfoView Event个人中心")
|
||||
// openOperationalInfoView()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun openOperationalInfoView() {
|
||||
personalDialogFragment = WeakReference(TaxiPersonalDialogFragment())
|
||||
activity?.supportFragmentManager?.let {
|
||||
personalDialogFragment!!.get()
|
||||
?.show(it, "service_data")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return "TaxiFragment"
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
loginService =
|
||||
@@ -83,24 +117,20 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
mPresenter.startNaviToEndStation(isShow)
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return "TaxiFragment"
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
super.initViews()
|
||||
initFragment()
|
||||
hidPanel()
|
||||
hideDebugPanel()
|
||||
switchVRFlatMode(MogoStatusManager.getInstance().isVrMode)
|
||||
module_mogo_och_operation_status.visibility = View.VISIBLE
|
||||
initOrderTestBar()
|
||||
initOrderDebugView()
|
||||
}
|
||||
|
||||
private fun initFragment() {
|
||||
serverOrdersFragmentWR = WeakReference(TaxiServerOrdersFragment.newInstance())
|
||||
servedOrdersFragment = WeakReference(TaxiServerOrdersFragment.newInstance())
|
||||
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
|
||||
//默认显示OCHTaxiServerOrdersFragment
|
||||
serverOrdersFragmentWR?.get()?.let {
|
||||
servedOrdersFragment?.get()?.let {
|
||||
transaction.add(R.id.fragment_container, it).show(
|
||||
it
|
||||
)
|
||||
@@ -114,14 +144,14 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
|
||||
override fun onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus()
|
||||
if (null == serverOrdersFragmentWR || serverOrdersFragmentWR!!.get() == null) return
|
||||
serverOrdersFragmentWR!!.get()!!.onChangeOperationStatus()
|
||||
if (null == servedOrdersFragment || servedOrdersFragment!!.get() == null) return
|
||||
servedOrdersFragment!!.get()!!.onChangeOperationStatus()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateReserveOrderChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?){
|
||||
if (null == serverOrdersFragmentWR || serverOrdersFragmentWR!!.get() == null) return
|
||||
serverOrdersFragmentWR!!.get()!!.updateOrderChanged(taskAndOrder)
|
||||
fun updateReserveOrderChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
if (null == servedOrdersFragment || servedOrdersFragment!!.get() == null) return
|
||||
servedOrdersFragment!!.get()!!.updateOrderChanged(taskAndOrder)
|
||||
}
|
||||
|
||||
fun switchVRFlatMode(isVRMode: Boolean) {
|
||||
@@ -161,7 +191,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
null,
|
||||
null
|
||||
)
|
||||
showPanel()
|
||||
showDebugPanel()
|
||||
} else {
|
||||
taxi_driver_role_tv.visibility = View.GONE
|
||||
module_mogo_och_operation_status.text = "接单"
|
||||
@@ -175,35 +205,27 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
}
|
||||
|
||||
override fun onMapLoaded() {}
|
||||
|
||||
fun updateAutopilotStatus(status: Int) {
|
||||
onAutopilotStatusChanged(status)
|
||||
}
|
||||
|
||||
fun onNaviToEnd(isAmap: Boolean, isShow: Boolean) {
|
||||
if (isAmap) {
|
||||
if (null == serverOrdersFragmentWR || serverOrdersFragmentWR!!.get() == null) return
|
||||
serverOrdersFragmentWR!!.get()!!.onNaviToEndAMap(isShow)
|
||||
} else if (isShow) { //使用rotting数据
|
||||
showRottingToStationFragment(true)
|
||||
if (null == servedOrdersFragment || servedOrdersFragment!!.get() == null) return
|
||||
servedOrdersFragment!!.get()!!.onNaviToEndAMap(isShow)
|
||||
} else if (isShow) { //使用routing数据
|
||||
showRoutingToStationFragment(true)
|
||||
} else {
|
||||
showAmapNaviToStationFragment(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德计算出来的到达目的地的剩余里程和时间
|
||||
* @param meters
|
||||
* @param timeInSecond
|
||||
*/
|
||||
fun reportToEndDisAndTime(meters: Int, timeInSecond: Long) { //米/秒
|
||||
mPresenter.reportToEndDisAndTime(meters.toString().toLong(), timeInSecond)
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单流转debug START
|
||||
*/
|
||||
private fun initOrderTestBar() {
|
||||
findViewById<View>(R.id.test_bar_to_virtual)?.setOnClickListener{
|
||||
private fun initOrderDebugView() {
|
||||
findViewById<View>(R.id.test_bar_to_virtual)?.setOnClickListener {
|
||||
TaxiModel.setArriveAtUntruthStation()
|
||||
}
|
||||
|
||||
@@ -211,7 +233,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
TaxiModel.setArriveAtEndStation()
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.test_bar_start_service_confirm)?.setOnClickListener{
|
||||
findViewById<View>(R.id.test_bar_start_service_confirm)?.setOnClickListener {
|
||||
TaxiModel.toStartTask()
|
||||
}
|
||||
|
||||
@@ -221,100 +243,20 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
}
|
||||
TaxiModel.setOnTheWayToEndStation()
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.test_bar_route)?.setOnClickListener { testRouteInfoUpload() }
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(eventLogout: EventLogout) {
|
||||
if (eventLogout.messgae == EventLogout.LOGOUT_TYPE) {
|
||||
d(SceneConstant.M_TAXI + TAG, "changeOverview Event消息去登出")
|
||||
mPresenter.logout()
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun openOperationalInfoView(eventLogout: EventLogout) {
|
||||
// if (eventLogout.messgae == EventLogout.PERSONAL_TYPE) {
|
||||
// 个人信息, 运营数据在无人化阶段暂时不展示
|
||||
// d(SceneConstant.M_TAXI + TAG, "openOperationalInfoView Event个人中心")
|
||||
// openOperationalInfoView()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun openOperationalInfoView() {
|
||||
personalDialogFragment = WeakReference(TaxiPersonalDialogFragment())
|
||||
activity?.supportFragmentManager?.let {
|
||||
personalDialogFragment!!.get()
|
||||
?.show(it, "service_data")
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun onCurrentOrderDistToEndChanged(meters: Long, timeInSecond: Long) {
|
||||
if (null == serverOrdersFragmentWR || serverOrdersFragmentWR!!.get() == null) return
|
||||
serverOrdersFragmentWR!!.get()!!.onCurrentOrderDistToEndChanged(meters, timeInSecond)
|
||||
if (null == servedOrdersFragment || servedOrdersFragment!!.get() == null) return
|
||||
servedOrdersFragment!!.get()!!.onCurrentOrderDistToEndChanged(meters, timeInSecond)
|
||||
}
|
||||
|
||||
private fun testRouteInfoUpload() {
|
||||
TPRouteDataTestUtils.converToRouteData()
|
||||
}
|
||||
|
||||
//region Taxi调试信息:订单、线路、轨迹等信息
|
||||
private var testBar: View? = null
|
||||
private var testCurOrderId: TextView? = null
|
||||
private var testCurLineId: TextView? = null
|
||||
private var testCurTrajMd5: TextView? = null
|
||||
private var testCurStopMd5: TextView? = null
|
||||
private var testCurTrajMd5DPQP: TextView? = null
|
||||
private var testCurStopMd5DPQP: TextView? = null
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun clickTestBar() {
|
||||
if (testBar == null) {
|
||||
testBar = findViewById<View>(R.id.module_och_taxi_order_status_change_test_bar)
|
||||
testCurOrderId = findViewById<TextView>(R.id.test_bar_current_order_id)
|
||||
testCurLineId = findViewById<TextView>(R.id.test_bar_current_line_id)
|
||||
testCurTrajMd5 = findViewById<TextView>(R.id.test_bar_current_traj_md5)
|
||||
testCurStopMd5 = findViewById<TextView>(R.id.test_bar_current_stop_md5)
|
||||
testCurTrajMd5DPQP = findViewById<TextView>(R.id.test_bar_current_traj_md5_dpqp)
|
||||
testCurStopMd5DPQP = findViewById<TextView>(R.id.test_bar_current_stop_md5_dpqp)
|
||||
}
|
||||
if (testBar!!.visibility == View.VISIBLE) {
|
||||
testBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val result = TaxiModel.getCurTaskAndOrder()
|
||||
val order = result?.order
|
||||
testCurOrderId!!.text = "orderNo: " + order?.orderNo
|
||||
testCurLineId!!.text = "当前任务lineId: " + result?.lineId
|
||||
taskType2.text = "当前任务类型: " + result?.taskType
|
||||
taskStatus2.text = "任务状态: "+ result?.currentStatus
|
||||
taskStartSite.text = "任务开始站点: "+ result?.startSite?.siteName +
|
||||
", siteId: " + result?.startSite?.siteId
|
||||
taskEndSite.text = "任务结束站点: "+ result?.endSite?.siteName +
|
||||
", siteId: " + result?.endSite?.siteId
|
||||
|
||||
orderInfo.text = "订单信息: 开始: " + order?.orderStartSite?.siteName + ", 结束: "+
|
||||
order?.orderEndSite?.siteName + ", orderStatus: "+ order?.orderStatus
|
||||
|
||||
orderToStartLines.text = "接驾任务的lineId集合: " + GsonUtil.jsonFromObject(order?.planningLines)
|
||||
|
||||
val curContrail = TaxiModel.getCurTaskContrail()
|
||||
testCurTrajMd5!!.text = "TMd5:" + curContrail?.csvFileMd5
|
||||
testCurStopMd5!!.text = "SMd5:" + curContrail?.txtFileMd5
|
||||
testCurTrajMd5DPQP!!.text =
|
||||
"TMd5DPQP:" + curContrail?.csvFileMd5DPQP
|
||||
testCurStopMd5DPQP!!.text =
|
||||
"SMd5DPQP:" + curContrail?.txtFileMd5DPQP
|
||||
testBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaxiFragment"
|
||||
fun newInstance(): TaxiFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TaxiFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
fun clickOrderDebugView() {
|
||||
orderDebugView.updateData()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
package com.mogo.och.taxi.ui.base;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
@@ -11,7 +9,6 @@ import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
@@ -19,17 +16,16 @@ import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst;
|
||||
import com.mogo.och.taxi.constant.TaxiDriverRoleEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst;
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiFragment;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASStatusCallback,
|
||||
@@ -47,17 +43,10 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, "网约车-出租车拿到订单" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
releaseListeners();
|
||||
TaxiModel.INSTANCE.release();
|
||||
super.onDestroy(owner);
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
@@ -74,12 +63,12 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.INSTANCE.setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
private void runOnUIThread(Runnable executor) {
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(executor);
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
@@ -103,17 +92,16 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
}
|
||||
|
||||
//导航去订单目的地
|
||||
public void startNaviToEndStation(boolean isShow){
|
||||
TaxiModel.INSTANCE.startNaviToEndStation(isShow);
|
||||
public void startNaviToEndStation(boolean isShow) {
|
||||
TaxiModel.INSTANCE.startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration){//米/秒
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration) {//米/秒
|
||||
// TaxiModel.INSTANCE.reportOrderRemain(lastSumLength,duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,17 +120,16 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
if (preAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
if (preAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
runOnUIThread(() -> mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
}
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onManMachineCoDriving() {
|
||||
runOnUIThread(() -> mView.onManMachineCoDriving(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING));
|
||||
public void onParallelDrivingStatus() {
|
||||
runOnUIThread(() -> mView.onParallelDrivingStatus(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING));
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING;
|
||||
}
|
||||
|
||||
@@ -153,12 +140,12 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
@Override
|
||||
public void onNaviToEnd(boolean isAmap, boolean isShow) {
|
||||
runOnUIThread( () -> mView.onNaviToEnd(isAmap,isShow));
|
||||
runOnUIThread(() -> mView.onNaviToEnd(isAmap, isShow));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToEndChanged(meters,timeInSecond));
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToEndChanged(meters, timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,7 +155,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (null != location){
|
||||
if (null != location) {
|
||||
runOnUIThread(() -> {
|
||||
mView.updateSpeedView((float) location.getGnssSpeed());
|
||||
});
|
||||
@@ -207,13 +194,12 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
mView.updateOperationStatus(TaxtServingStatusManager.isOpeningOrderStatus(), finalRole);
|
||||
});
|
||||
|
||||
if (!TaxiModel.INSTANCE.checkCurrentTask()){
|
||||
mView.showPanel();
|
||||
if (!TaxiModel.INSTANCE.checkCurrentTask()) {
|
||||
mView.showDebugPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginFail(boolean isLogin) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.och.taxi.ui.debug
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderDebugContainer
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderInfo
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderToStartLines
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskEndSite
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskStartSite
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskStatus2
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskType2
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_line_id
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_order_id
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_stop_md5
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_stop_md5_dpqp
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_traj_md5
|
||||
import kotlinx.android.synthetic.main.taxi_debug_order.view.test_bar_current_traj_md5_dpqp
|
||||
|
||||
class OrderDebugView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
defStyleRes: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) {
|
||||
companion object {
|
||||
const val TAG = "OrderDebugView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.taxi_debug_order, this, true)
|
||||
visibility = GONE
|
||||
}
|
||||
|
||||
fun updateData() {
|
||||
val data = TaxiModel.getCurTaskAndOrder()
|
||||
if (data == null) {
|
||||
orderDebugContainer?.visibility = View.GONE
|
||||
return
|
||||
|
||||
}
|
||||
orderDebugContainer.visibility =
|
||||
if (orderDebugContainer?.visibility == View.VISIBLE)
|
||||
View.GONE
|
||||
else
|
||||
View.VISIBLE
|
||||
data.order?.also {
|
||||
test_bar_current_order_id.text = "orderNo: $it.orderNo"
|
||||
test_bar_current_line_id!!.text = "当前任务lineId: $it.lineId"
|
||||
taskType2.text = "当前任务类型: $it.taskType"
|
||||
taskStatus2.text = "任务状态: $it.currentStatus"
|
||||
taskStartSite.text =
|
||||
"任务开始站点: ${data.startSite?.siteName} , siteId: ${data.startSite?.siteId}"
|
||||
taskEndSite.text =
|
||||
"任务结束站点: ${data.endSite?.siteName}, siteId: ${data?.endSite?.siteId}"
|
||||
orderInfo.text =
|
||||
"订单信息: 开始: ${it.orderStartSite?.siteName}, 结束: ${it.orderEndSite?.siteName}, orderStatus: ${it.orderStatus}"
|
||||
orderToStartLines.text =
|
||||
"接驾任务的lineId集合: " + GsonUtil.jsonFromObject(it.planningLines)
|
||||
|
||||
val curContrail = TaxiModel.getCurTaskContrail()
|
||||
curContrail?.also {
|
||||
test_bar_current_traj_md5.text = "TrajMd5: ${curContrail?.csvFileMd5}"
|
||||
test_bar_current_stop_md5.text = "StopMd5: ${curContrail?.txtFileMd5}"
|
||||
test_bar_current_traj_md5_dpqp.text = "TrajMd5DPQP: ${curContrail?.csvFileMd5DPQP}"
|
||||
test_bar_current_stop_md5_dpqp.text = "StopMd5DPQP: ${curContrail?.txtFileMd5DPQP}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,6 @@
|
||||
android:textColor="@color/taxi_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textStyle="bold"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/orderDebugContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_order_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_line_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskType2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStatus2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStartSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskEndSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderToStartLines"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_traj_md5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_stop_md5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_traj_md5_dpqp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_stop_md5_dpqp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_to_virtual"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达标定站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_start_service_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开启服务"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_on_the_way_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开启自动驾驶"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_route"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="模拟轨迹"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -15,133 +15,11 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_och_taxi_order_status_change_test_bar"
|
||||
<com.mogo.och.taxi.ui.debug.OrderDebugView
|
||||
android:id="@+id/orderDebugView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_order_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_line_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskType2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStatus2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStartSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskEndSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderToStartLines"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_traj_md5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_stop_md5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_traj_md5_dpqp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_stop_md5_dpqp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_to_virtual"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达标定站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_start_service_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开启服务"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_on_the_way_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开启自动驾驶"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_route"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="模拟轨迹"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
Reference in New Issue
Block a user