Merge branch 'dev_robotaxi-d_230809_6.0.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_230809_6.0.0
This commit is contained in:
@@ -26,13 +26,15 @@ object CharterTrajectoryManager {
|
||||
private const val TAG = "CharterTrajectoryManager"
|
||||
private var mAutoPilotLine: AutoPilotLine? = null
|
||||
private var mLineId = 0
|
||||
private var mLineName = ""
|
||||
private var mSendReqDisposable: Disposable? = null
|
||||
|
||||
/**
|
||||
* 同步Bus路线信息
|
||||
*/
|
||||
fun syncTrajectoryInfo(lineId: Int) {
|
||||
fun syncTrajectoryInfo(lineId: Int, lineName: String) {
|
||||
mLineId = lineId
|
||||
mLineName = lineName
|
||||
val routesResult = get().getBusRoutesResult()
|
||||
if (LoginStatusManager.isLogin() && routesResult != null) {
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "syncTrajectoryInfo() start.")
|
||||
@@ -81,7 +83,8 @@ object CharterTrajectoryManager {
|
||||
} else if ("ISSM_FUNC_AUTO_PILOT_READY" == guardianInfo.getCode()) {
|
||||
// 收到ssm的自动驾驶变为ready,再次下发轨迹下载.解决:域控重启,或者102域控启动太早,107节点初始化未完成导致的轨迹未进行下载。
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() ssm ready,再次发起下载")
|
||||
syncTrajectoryInfo(get().getBusOrderResult()?.lineId!!)
|
||||
syncTrajectoryInfo(get().getBusOrderResult()?.lineId!!,
|
||||
get().getBusOrderResult()?.lineName!!)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +99,7 @@ object CharterTrajectoryManager {
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = AutoPilotLine(
|
||||
mLineId.toLong(),
|
||||
mLineId.toLong(), mLineName,
|
||||
routesResult.csvFileUrl, routesResult.csvFileMd5,
|
||||
routesResult.txtFileUrl, routesResult.txtFileMd5,
|
||||
routesResult.contrailSaveTime, routesResult.carModel,
|
||||
@@ -106,6 +109,7 @@ object CharterTrajectoryManager {
|
||||
)
|
||||
} else {
|
||||
mAutoPilotLine!!.lineId = mLineId.toLong()
|
||||
mAutoPilotLine!!.lineName = mLineName
|
||||
mAutoPilotLine!!.trajUrl = routesResult.csvFileUrl
|
||||
mAutoPilotLine!!.trajMd5 = routesResult.csvFileMd5
|
||||
mAutoPilotLine!!.stopUrl = routesResult.txtFileUrl
|
||||
@@ -124,6 +128,7 @@ object CharterTrajectoryManager {
|
||||
private fun clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return
|
||||
mAutoPilotLine!!.lineId = -1
|
||||
mAutoPilotLine!!.lineName = ""
|
||||
mAutoPilotLine!!.trajUrl = ""
|
||||
mAutoPilotLine!!.trajMd5 = ""
|
||||
mAutoPilotLine!!.stopUrl = ""
|
||||
@@ -206,7 +211,7 @@ object CharterTrajectoryManager {
|
||||
|
||||
init {
|
||||
mAutoPilotLine = AutoPilotLine(
|
||||
-1,
|
||||
-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0
|
||||
)
|
||||
|
||||
@@ -607,7 +607,7 @@ class DriverM1Model {
|
||||
parameters.vehicleType = VEHICLE_TYPE
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
||||
mCurrentOrder!!.lineId.toLong(),
|
||||
mCurrentOrder!!.lineId.toLong(), mCurrentOrder!!.lineName,
|
||||
mCurrentRoute!!.csvFileUrl, mCurrentRoute!!.csvFileMd5,
|
||||
mCurrentRoute!!.txtFileUrl, mCurrentRoute!!.txtFileMd5,
|
||||
mCurrentRoute!!.contrailSaveTime, mCurrentRoute!!.carModel,
|
||||
@@ -841,7 +841,8 @@ class DriverM1Model {
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "checkoutContrail-=="
|
||||
+ GsonUtils.toJson(data.data))
|
||||
mCurrentRoute = data.data
|
||||
CharterTrajectoryManager.syncTrajectoryInfo(mCurrentOrder?.lineId!!)
|
||||
CharterTrajectoryManager.syncTrajectoryInfo(mCurrentOrder?.lineId!!,
|
||||
mCurrentOrder?.lineName!!)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
|
||||
@@ -120,7 +120,6 @@ object CharterPassengerModel {
|
||||
private var carTypeChageListener: IOrderChangeCallback? = null
|
||||
|
||||
private var subscribeCountDown: Disposable? = null
|
||||
var switchLine5minWait: Disposable? = null
|
||||
|
||||
@Volatile
|
||||
var newCheckedSite: SiteInfoResponse.SiteInfo? = null
|
||||
@@ -529,7 +528,6 @@ object CharterPassengerModel {
|
||||
orderInfo = null
|
||||
locusInfo = null
|
||||
if (data.businessStatus == 2) {// 订单结束 没有还车
|
||||
RxUtils.disposeSubscribe(switchLine5minWait)
|
||||
clearAutopilotControlParameters()
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUse)
|
||||
} else {
|
||||
@@ -985,7 +983,6 @@ object CharterPassengerModel {
|
||||
d(M_BUS_P + BaseDPMsg.TAG, "到站发送数据${msg}")
|
||||
}
|
||||
|
||||
RxUtils.disposeSubscribe(switchLine5minWait)
|
||||
// 清理轨迹
|
||||
cleanRoutePoints()
|
||||
// 到站结束自驾
|
||||
@@ -1028,10 +1025,6 @@ object CharterPassengerModel {
|
||||
broadcastList[requestSuccessSign] == null || broadcastList[requestSuccessSign] == false
|
||||
|
||||
fun cleanbroadcastListInfo(checkSite: SiteInfoResponse.SiteInfo?) {
|
||||
RxUtils.disposeSubscribe(switchLine5minWait)
|
||||
switchLine5minWait = RxUtils.createSubscribe(5 * 60 * 1000) {
|
||||
d(M_BUS_P + BaseDPMsg.TAG, "5分钟倒计时可以选择线路了")
|
||||
}
|
||||
newCheckedSite = checkSite
|
||||
cleanRoutePoints()
|
||||
broadcastList.clear()
|
||||
@@ -1132,9 +1125,8 @@ object CharterPassengerModel {
|
||||
locusInfo?.let { locus ->
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
orderInfo.lineId!!,
|
||||
locus.csvFileUrl!!,
|
||||
locus.csvFileMd5!!,
|
||||
orderInfo.lineId!!, orderInfo.lineName!!,
|
||||
locus.csvFileUrl!!, locus.csvFileMd5!!,
|
||||
locus.txtFileUrl!!, locus.txtFileMd5!!,
|
||||
locus.contrailSaveTime!!, locus.carModel!!,
|
||||
locus.csvFileUrlDPQP!!, locus.csvFileMd5DPQP!!,
|
||||
|
||||
@@ -57,8 +57,6 @@ class BusPassengerFunctionOrderPresenter(view: M1OrderLineFragment?) :
|
||||
// 向司机端临时提交的终点站点
|
||||
private var tempCheckSite: SiteInfoResponse.SiteInfo? = null
|
||||
|
||||
|
||||
private var subscribeSelectLine: Disposable? = null
|
||||
private var subscribeSelectSite: Disposable? = null
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
@@ -189,7 +187,6 @@ class BusPassengerFunctionOrderPresenter(view: M1OrderLineFragment?) :
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
CallerLogger.d(M_BUS_P + TAG, "onDestroy")
|
||||
RxUtils.disposeSubscribe(subscribeSelectLine)
|
||||
RxUtils.disposeSubscribe(subscribeSelectSite)
|
||||
BizLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
CharterPassengerModel.setStatusChangeListener(TAG,null)
|
||||
|
||||
@@ -184,7 +184,7 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
UiThreadHandler.post {
|
||||
when (actionStatus) {
|
||||
StopSideStatusManager.Status.NOSTART -> {
|
||||
ToastCharterUtils.showShort(errorInfo)
|
||||
ToastCharterUtils.showShort(errorInfo?:"")
|
||||
}
|
||||
|
||||
StopSideStatusManager.Status.START -> {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
|
||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
||||
@@ -22,10 +23,11 @@ import com.mogo.och.bus.passenger.callback.IClearViewCallback
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerPresenter
|
||||
import com.mogo.och.bus.passenger.ui.bottom.BottomBar
|
||||
import com.mogo.och.bus.passenger.ui.bottom.BottomClickView
|
||||
import com.mogo.och.common.module.manager.debug.DebugViewWatchDogFragment
|
||||
import com.mogo.och.bus.passenger.ui.dialogfragment.M1CarUserNoOrderFragment
|
||||
import com.mogo.och.bus.passenger.ui.dialogfragment.M1ContainFragment
|
||||
import com.mogo.och.bus.passenger.ui.dialogfragment.NoviceGuidanceFragment
|
||||
import com.mogo.och.bus.passenger.utils.ToastCharterUtils
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import kotlinx.android.synthetic.main.m1_main_fragment.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -44,13 +46,17 @@ class MainFragment :
|
||||
private var noviceGuidanceFragment: WeakReference<NoviceGuidanceFragment>? = null
|
||||
|
||||
private val endStation =
|
||||
BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources,
|
||||
R.drawable.m1_small_map_view_dir_end)
|
||||
BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.m1_small_map_view_dir_end
|
||||
)
|
||||
private val lineTrajectory =
|
||||
BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources,
|
||||
R.drawable.charter_p_trajectory_line)
|
||||
BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.charter_p_trajectory_line
|
||||
)
|
||||
|
||||
private val goneView = object : IClearViewCallback{
|
||||
private val goneView = object : IClearViewCallback {
|
||||
override fun goneAllView() {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.NONE)
|
||||
}
|
||||
@@ -90,20 +96,34 @@ class MainFragment :
|
||||
|
||||
})
|
||||
|
||||
bb_boorombar.setCheckChangeListener(object :BottomBar.ApplyClickLintener{
|
||||
override fun onApplyClick(selectItem: BottomBar.SelectView) {
|
||||
bb_boorombar.setCheckChangeListener(object : BottomBar.ApplyClickLintener {
|
||||
override fun onApplyClick(selectItem: BottomBar.SelectView): Boolean {
|
||||
when (selectItem) {
|
||||
BottomBar.SelectView.ORDERINFO -> showBizView(orderinfo = true)
|
||||
BottomBar.SelectView.ORDERINFO -> {
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
if (mPresenter?.haveOrder() == true) {
|
||||
|
||||
} else {
|
||||
ToastCharterUtils.showShort("请确认订单")
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
ToastCharterUtils.showShort(requireContext().getString(R.string.m1_please_login_driver))
|
||||
return true
|
||||
}
|
||||
showBizView(orderinfo = true)
|
||||
}
|
||||
BottomBar.SelectView.SETTING -> showBizView(softControl = true)
|
||||
BottomBar.SelectView.LINE -> showBizView(selectLine = true)
|
||||
//BottomBar.SelectView.VIDEO -> TODO()
|
||||
else ->{
|
||||
BottomBar.SelectView.VIDEO -> showBizView(showVideo = true)
|
||||
else -> {
|
||||
showBizView()
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
bb_boorombar.setApplyClickListener(object : BottomClickView.ApplyClickLintener{
|
||||
bb_boorombar.setApplyClickListener(object : BottomClickView.ApplyClickLintener {
|
||||
override fun onApplyClick() {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.NONE)
|
||||
}
|
||||
@@ -111,9 +131,10 @@ class MainFragment :
|
||||
biz_orderinfo.goneViewListener = goneView
|
||||
biz_softcontrol.goneViewListener = goneView
|
||||
biz_selectline.goneViewListener = goneView
|
||||
biz_video.goneViewListener = goneView
|
||||
|
||||
aciv_enter_video.setOnClickListener{
|
||||
openSettingPage(M1ContainFragment.VIDEOTAB)
|
||||
aciv_enter_video.setOnClickListener {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.VIDEO)
|
||||
}
|
||||
aciv_map_2_default.setOnClickListener {
|
||||
omvOverMap.displayCustomOverView()
|
||||
@@ -127,26 +148,36 @@ class MainFragment :
|
||||
}
|
||||
}
|
||||
|
||||
fun setCarMode(type: Int){
|
||||
fun setCarMode(type: Int) {
|
||||
mPresenter?.setCarChangeListener(type)
|
||||
}
|
||||
|
||||
private fun showBizView(orderinfo:Boolean=false,softControl:Boolean=false,selectLine:Boolean=false){
|
||||
if(orderinfo){
|
||||
private fun showBizView(
|
||||
orderinfo: Boolean = false,
|
||||
softControl: Boolean = false,
|
||||
selectLine: Boolean = false,
|
||||
showVideo: Boolean = false
|
||||
) {
|
||||
if (orderinfo) {
|
||||
biz_orderinfo.visibility = View.VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
biz_orderinfo.visibility = View.GONE
|
||||
}
|
||||
if(softControl){
|
||||
if (softControl) {
|
||||
biz_softcontrol.visibility = View.VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
biz_softcontrol.visibility = View.GONE
|
||||
}
|
||||
if(selectLine){
|
||||
if (selectLine) {
|
||||
biz_selectline.visibility = View.VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
biz_selectline.visibility = View.GONE
|
||||
}
|
||||
if (showVideo) {
|
||||
biz_video.visibility = View.VISIBLE
|
||||
} else {
|
||||
biz_video.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun openSettingPage(tab: String) {
|
||||
@@ -154,10 +185,15 @@ class MainFragment :
|
||||
bpFunctionGroupDialogFragment = WeakReference(M1ContainFragment.newInstance())
|
||||
}
|
||||
val bpFunctionGroup = bpFunctionGroupDialogFragment?.get()
|
||||
M1ContainFragment.openSettingPage(childFragmentManager,parentFragmentManager,bpFunctionGroup,tab)
|
||||
M1ContainFragment.openSettingPage(
|
||||
childFragmentManager,
|
||||
parentFragmentManager,
|
||||
bpFunctionGroup,
|
||||
tab
|
||||
)
|
||||
}
|
||||
|
||||
fun setCarModle(rawInfo: Int){
|
||||
fun setCarModle(rawInfo: Int) {
|
||||
getMapUIController()?.changeCurrentIcon(rawInfo)
|
||||
HdMapBuildConfig.currentCarVrIconRes = rawInfo
|
||||
}
|
||||
@@ -169,14 +205,16 @@ class MainFragment :
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView.onCreate(savedInstanceState)
|
||||
getMapUIController()?.setAllGesturesEnabled(false)
|
||||
omvOverMap.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
fun drawEndStation(latLng: LatLng) {
|
||||
val listOf = listOf(latLng)
|
||||
omvOverMap.drawSiteMarkers(listOf,endStation,0.5f,1f)
|
||||
omvOverMap.drawSiteMarkers(listOf, endStation, 0.5f, 1f)
|
||||
}
|
||||
fun cleanEndStation(){
|
||||
|
||||
fun cleanEndStation() {
|
||||
omvOverMap.clearSiteMarkers()
|
||||
omvOverMap.clearCustomPolyline()
|
||||
}
|
||||
@@ -220,23 +258,33 @@ class MainFragment :
|
||||
m1CarUserNoOrderFragment = WeakReference(M1CarUserNoOrderFragment.newInstance())
|
||||
}
|
||||
val m1CarUserNoOrderFragment = m1CarUserNoOrderFragment?.get()
|
||||
M1CarUserNoOrderFragment.showOpenAndCloseDoor(childFragmentManager,parentFragmentManager,m1CarUserNoOrderFragment)
|
||||
M1CarUserNoOrderFragment.showOpenAndCloseDoor(
|
||||
childFragmentManager,
|
||||
parentFragmentManager,
|
||||
m1CarUserNoOrderFragment
|
||||
)
|
||||
}
|
||||
|
||||
fun showNoviceGuidanceFragment() {
|
||||
if (noviceGuidanceFragment?.get() == null) {
|
||||
noviceGuidanceFragment = WeakReference(NoviceGuidanceFragment.newInstance())
|
||||
}
|
||||
val noviceGuidanceFragmentWeak = noviceGuidanceFragment?.get()
|
||||
NoviceGuidanceFragment.showNoviceGuidance(childFragmentManager,parentFragmentManager,noviceGuidanceFragmentWeak)
|
||||
NoviceGuidanceFragment.showNoviceGuidance(
|
||||
childFragmentManager,
|
||||
parentFragmentManager,
|
||||
noviceGuidanceFragmentWeak
|
||||
)
|
||||
}
|
||||
fun closeOpenAndCloseDoor(){
|
||||
|
||||
fun closeOpenAndCloseDoor() {
|
||||
val bpFunctionGroup = m1CarUserNoOrderFragment?.get()
|
||||
bpFunctionGroup?.let {
|
||||
bpFunctionGroup.dismissAllowingStateLoss()
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
cleanEndStation()
|
||||
},2_000)
|
||||
}, 2_000)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -249,15 +297,18 @@ class MainFragment :
|
||||
omvOverMap?.clearSiteNameViews()
|
||||
mPresenter?.drawEndStation()
|
||||
} else {
|
||||
if(eventLineSites.lineInfo==null){//更新站点
|
||||
if (eventLineSites.lineInfo == null) {//更新站点
|
||||
mPresenter?.drawStationInfo(eventLineSites.sites!!)
|
||||
}else{// 更新轨迹和站点
|
||||
mPresenter?.getLineTrajectory(eventLineSites.lineInfo,eventLineSites.sites!!)
|
||||
} else {// 更新轨迹和站点
|
||||
mPresenter?.getLineTrajectory(eventLineSites.lineInfo, eventLineSites.sites!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun drawOverMapViewStation(stationsList: MutableList<SiteMarkerBean>,siteMarkers: List<SiteMarkerBean>?){
|
||||
fun drawOverMapViewStation(
|
||||
stationsList: MutableList<SiteMarkerBean>,
|
||||
siteMarkers: List<SiteMarkerBean>?
|
||||
) {
|
||||
omvOverMap?.clearSiteMarkers()
|
||||
omvOverMap?.clearSiteNameViews()
|
||||
omvOverMap?.drawSiteMarkers(stationsList)
|
||||
|
||||
@@ -47,12 +47,17 @@ class BottomBar @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun setCheckIndex(index: SelectView){
|
||||
if(checkIndex==index){
|
||||
checkIndex = SelectView.NONE
|
||||
val tempPreStatus = checkIndex
|
||||
checkIndex = if(checkIndex==index){
|
||||
SelectView.NONE
|
||||
}else{
|
||||
checkIndex = index
|
||||
index
|
||||
}
|
||||
if (overMapViewApply?.onApplyClick(checkIndex)==true) {
|
||||
// 外层业务拦截
|
||||
checkIndex = tempPreStatus
|
||||
return
|
||||
}
|
||||
overMapViewApply?.onApplyClick(checkIndex)
|
||||
if(checkIndex == SelectView.ORDERINFO){
|
||||
cl_order_time_press.visibility = VISIBLE
|
||||
cl_order_time.setCheck(true)
|
||||
@@ -78,7 +83,7 @@ class BottomBar @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
interface ApplyClickLintener{
|
||||
fun onApplyClick(selectItem:SelectView)
|
||||
fun onApplyClick(selectItem:SelectView):Boolean
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import kotlinx.android.synthetic.main.m1_bottom_orderinfo.view.*
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* 展示订单剩余时间
|
||||
*/
|
||||
open class BottomOrderInfoView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@@ -40,9 +43,11 @@ open class BottomOrderInfoView @JvmOverloads constructor(
|
||||
fun setCheck(isCheck:Boolean){
|
||||
if(isCheck){
|
||||
actv_order_end_time.setTextColor(context.getColor(android.R.color.white))
|
||||
actv_order_null.setTextColor(context.getColor(android.R.color.white))
|
||||
actv_order_end_time_title.setTextColor(context.getColor(android.R.color.white))
|
||||
}else{
|
||||
actv_order_end_time.setTextColor(context.getColor(R.color.bus_p_m1_0050E1))
|
||||
actv_order_null.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
actv_order_end_time_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ class OrderInfoView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
|
||||
var goneViewListener: IClearViewCallback?=null
|
||||
|
||||
var viewModel:OrderInfoViewModel?=null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_devices_fragment, this, true)
|
||||
onClick {
|
||||
@@ -54,7 +56,7 @@ class OrderInfoView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
val viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(OrderInfoViewModel::class.java)
|
||||
}
|
||||
|
||||
@@ -74,8 +76,19 @@ class OrderInfoView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
if(changedView!=this){
|
||||
return
|
||||
}
|
||||
if(visibility==View.VISIBLE) {
|
||||
viewModel?.getDataInfo()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setViewGone(){
|
||||
goneViewListener?.goneAllView()
|
||||
cl_order_info.visibility = View.VISIBLE
|
||||
cl_order_info_endorder_comfit.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun setLeftTime(leftTime:String){
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.callback.ITimeCallback
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.utils.ToastCharterUtils
|
||||
@@ -37,23 +38,29 @@ class OrderInfoViewModel: ViewModel(), ITimeCallback {
|
||||
getDataInfo()
|
||||
}
|
||||
|
||||
private fun getDataInfo() {
|
||||
fun getDataInfo() {
|
||||
val currentOrderInfo = CharterPassengerModel.getCurrentOrderInfo()
|
||||
currentOrderInfo?.let {
|
||||
viewCallback?.setPhone(it.passengerPhone?:"")
|
||||
if(currentOrderInfo!=null){
|
||||
viewCallback?.setPhone(currentOrderInfo.passengerPhone?:"")
|
||||
try {
|
||||
viewCallback?.setStartTimeAndEndTime(
|
||||
DateTimeUtil.formatLongToString(it.startTime!!, DateTimeUtil.HH_mm),
|
||||
DateTimeUtil.formatLongToString(it.endTime!!, DateTimeUtil.HH_mm))
|
||||
DateTimeUtil.formatLongToString(currentOrderInfo.startTime!!, DateTimeUtil.HH_mm),
|
||||
DateTimeUtil.formatLongToString(currentOrderInfo.endTime!!, DateTimeUtil.HH_mm))
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
}else{
|
||||
viewCallback?.setPhone("----")
|
||||
viewCallback?.setStartTimeAndEndTime("--:---", "--:--")
|
||||
viewCallback?.setLeftTime("剩余时间 --:--")
|
||||
}
|
||||
}
|
||||
|
||||
override fun setOrderTimeCallBack(timeInSecond: Long) {
|
||||
val leftTime = DateTimeUtil.second2Time(timeInSecond)
|
||||
viewCallback?.setLeftTime(leftTime)
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setLeftTime(leftTime)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,12 +116,6 @@ class M1OrderLineFragment :
|
||||
mPresenter?.resetData()
|
||||
}
|
||||
tv_site_submit.onClick {
|
||||
CharterPassengerModel.switchLine5minWait?.let {
|
||||
if (!it.isDisposed) {
|
||||
ToastCharterUtils.showShort("选择线路后5分钟内不可用选")
|
||||
return@onClick
|
||||
}
|
||||
}
|
||||
mPresenter?.changeSites(siteList)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.event.EventLineSites
|
||||
import com.mogo.och.bus.passenger.bean.response.LineInfoResponse
|
||||
import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
|
||||
import com.mogo.och.bus.passenger.callback.IClearViewCallback
|
||||
@@ -40,6 +41,7 @@ import kotlinx.android.synthetic.main.m1_order_fragment.view.tv_site_cancle
|
||||
import kotlinx.android.synthetic.main.m1_order_fragment.view.tv_site_submit
|
||||
import kotlinx.android.synthetic.main.m1_order_loading.view.iv_loading_wait_ent
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallback {
|
||||
|
||||
@@ -63,7 +65,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
var goneViewListener: IClearViewCallback?=null
|
||||
var goneViewListener: IClearViewCallback? = null
|
||||
|
||||
private lateinit var lineAdapter: OrderLineItemAdapter
|
||||
private lateinit var siteAdapter: OrderSiteItemAdapter
|
||||
@@ -74,6 +76,8 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
private var subscribeDirverAgree: Disposable? = null
|
||||
private var subscribeDirverRefuse: Disposable? = null
|
||||
|
||||
private var viewModel: SelectLineViewModel? = null
|
||||
|
||||
private val loadingAni =
|
||||
ObjectAnimator.ofFloat(iv_loading_wait_ent, "rotation", 0f, 90f, 180f, 270f, 360f)
|
||||
.apply {
|
||||
@@ -102,7 +106,8 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
)
|
||||
rlv_line_list.adapter = lineAdapter
|
||||
|
||||
rv_site_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rv_site_list.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rv_site_list.addItemDecoration(
|
||||
BottomDecoration(
|
||||
AutoSizeUtils.dp2px(context, 90f)
|
||||
@@ -113,7 +118,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(SelectLineViewModel::class.java)
|
||||
}
|
||||
|
||||
@@ -131,7 +136,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
}
|
||||
siteAdapter.checkChangeListener = object : OrderSiteItemAdapter.CheckListener {
|
||||
override fun canSwitchLine(): Boolean {
|
||||
return viewModel?.canSwitchLine()?:true
|
||||
return viewModel?.canSwitchLine() ?: true
|
||||
}
|
||||
|
||||
override fun onCheckListener(siteInfo: SiteInfoResponse.SiteInfo?) {
|
||||
@@ -144,17 +149,24 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
viewModel?.resetData()
|
||||
}
|
||||
tv_site_submit.onClick {
|
||||
CharterPassengerModel.switchLine5minWait?.let {
|
||||
if (!it.isDisposed) {
|
||||
ToastCharterUtils.showShort("选择线路后5分钟内不可用选")
|
||||
return@onClick
|
||||
}
|
||||
}
|
||||
viewModel?.changeSites(siteList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
if (changedView != this) {
|
||||
return
|
||||
}
|
||||
if (visibility == View.GONE || visibility == View.INVISIBLE) {
|
||||
EventBus.getDefault().post(EventLineSites(null, null, true))
|
||||
viewModel?.removeMsgListener()
|
||||
} else {
|
||||
viewModel?.addMsgListener()
|
||||
viewModel?.initData()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSelectData() {
|
||||
UiThreadHandler.post {
|
||||
g_lines_sites_data?.visibility = View.VISIBLE
|
||||
@@ -173,13 +185,19 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param showBiz 展示线路和站点
|
||||
* @param showNetError 网络错误页面
|
||||
* @param showNorOrder 没有网络请求
|
||||
* @param showLoading 登录司机端回复
|
||||
*/
|
||||
override fun setVisableByTrun(
|
||||
showBiz: Boolean,
|
||||
showNetError: Boolean,
|
||||
showNorOrder: Boolean,
|
||||
showLoading: Boolean
|
||||
) {
|
||||
if(showBiz){
|
||||
if (showBiz) {
|
||||
// 选择线路页面
|
||||
m1_order_noorder?.visibility = View.GONE
|
||||
m1_order_neterror?.visibility = View.GONE
|
||||
@@ -187,21 +205,21 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
m1_order_loading?.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
if(showNetError){
|
||||
if (showNetError) {
|
||||
m1_order_noorder?.visibility = View.GONE
|
||||
m1_order_neterror?.visibility = View.VISIBLE
|
||||
lsv_line_site?.visibility = View.GONE
|
||||
m1_order_loading?.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
if(showNorOrder){
|
||||
if (showNorOrder) {
|
||||
m1_order_noorder?.visibility = View.VISIBLE
|
||||
m1_order_neterror?.visibility = View.GONE
|
||||
lsv_line_site?.visibility = View.GONE
|
||||
m1_order_loading?.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
if(showLoading){
|
||||
if (showLoading) {
|
||||
m1_order_noorder?.visibility = View.GONE
|
||||
m1_order_neterror?.visibility = View.GONE
|
||||
lsv_line_site?.visibility = View.GONE
|
||||
@@ -212,6 +230,9 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机同意所选线路
|
||||
*/
|
||||
override fun hideDataDriverAgree() {
|
||||
group_driver_agrenn_line?.visibility = View.VISIBLE
|
||||
aciv_driver_refuse_group?.visibility = View.GONE
|
||||
@@ -224,6 +245,9 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示确认和取消按钮
|
||||
*/
|
||||
override fun setEnableSiteStatus(cancleAndSubmit: Boolean) {
|
||||
if (cancleAndSubmit) {
|
||||
g_side_cancle_submit_group?.visibility = View.VISIBLE
|
||||
@@ -236,6 +260,12 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
lineAdapter.submitLine(lineInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机拒绝请求展示的页面
|
||||
* ① 司机拒绝
|
||||
* ② 2分钟超时
|
||||
* ③ 请求中和司机端断开链接
|
||||
*/
|
||||
override fun hideDataDriverRefuse() {
|
||||
group_driver_agrenn_line?.visibility = View.GONE
|
||||
aciv_driver_refuse_group?.visibility = View.VISIBLE
|
||||
@@ -252,7 +282,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
lineInfo: List<LineInfoResponse.LineInfo>,
|
||||
checkLine: LineInfoResponse.LineInfo?
|
||||
) {
|
||||
lineAdapter.setDataList(lineInfo,checkLine)
|
||||
lineAdapter.setDataList(lineInfo, checkLine)
|
||||
}
|
||||
|
||||
override fun siteAdapterEnableIndex(index: Int) {
|
||||
@@ -263,8 +293,9 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb
|
||||
siteAdapter.setDataList(siteInfo)
|
||||
}
|
||||
|
||||
private fun setViewGone(){
|
||||
private fun setViewGone() {
|
||||
goneViewListener?.goneAllView()
|
||||
showSelectData()
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -64,7 +64,6 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
private var tempCheckSite: SiteInfoResponse.SiteInfo? = null
|
||||
|
||||
|
||||
private var subscribeSelectLine: Disposable? = null
|
||||
private var subscribeSelectSite: Disposable? = null
|
||||
|
||||
/**
|
||||
@@ -108,7 +107,7 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
viewCallback?.hideDataDriverRefuse()
|
||||
}
|
||||
RxUtils.disposeSubscribe(subscribeSelectSite)
|
||||
BizLoopManager.removeLoopFunction(BusPassengerFunctionOrderPresenter.TAGLINELOOP)
|
||||
BizLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,16 +116,23 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
|
||||
init {
|
||||
CharterPassengerModel.setStatusChangeListener(TAG, this)
|
||||
CallerTelematicListenerManager.addListener(TAG, msgReceived)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
RxUtils.disposeSubscribe(subscribeSelectLine)
|
||||
RxUtils.disposeSubscribe(subscribeSelectSite)
|
||||
BizLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
CharterPassengerModel.setStatusChangeListener(TAG, null)
|
||||
}
|
||||
|
||||
fun addMsgListener() {
|
||||
CallerTelematicListenerManager.addListener(TAG, msgReceived)
|
||||
}
|
||||
|
||||
fun removeMsgListener() {
|
||||
RxUtils.disposeSubscribe(subscribeSelectSite)
|
||||
BizLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@@ -139,6 +145,10 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
|
||||
fun setVIewCallback(viewCallback: SelectLineViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
initData()
|
||||
}
|
||||
|
||||
fun initData(){
|
||||
val currentOrderStatus = CharterPassengerModel.getCurrentOrderStatus()
|
||||
needRunUI(currentOrderStatus)
|
||||
extracted()
|
||||
@@ -240,10 +250,7 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
}
|
||||
viewCallback?.hideDataWaitDriverMsg()
|
||||
// 启动查看和司机端链接
|
||||
BizLoopManager.setLoopFunction(
|
||||
BusPassengerFunctionOrderPresenter.TAGLINELOOP,
|
||||
LoopInfo(3, ::checkServerStatus)
|
||||
)
|
||||
BizLoopManager.setLoopFunction(TAGLINELOOP, LoopInfo(3, ::checkServerStatus))
|
||||
|
||||
RxUtils.disposeSubscribe(subscribeSelectSite)
|
||||
subscribeSelectSite = RxUtils.createSubscribe(120_000) {
|
||||
@@ -310,10 +317,10 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
private fun checkServerStatus() {
|
||||
if (!CallerTelematicManager.getClientConnStatus()) {
|
||||
ToastCharterUtils.showShort("断开和司机端连接、请联系安全员")
|
||||
BizLoopManager.removeLoopFunction(BusPassengerFunctionOrderPresenter.TAGLINELOOP)
|
||||
BizLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
viewCallback?.hideDataDriverRefuse()
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + BusPassengerFunctionOrderPresenter.TAG,
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"endAni666"
|
||||
)
|
||||
}
|
||||
@@ -325,10 +332,10 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
fun resetData() {
|
||||
tempCheckLine = null
|
||||
tempCheckSite = null
|
||||
if(checkLine==null){// 没有提交线路
|
||||
if (checkLine == null) {// 没有提交线路
|
||||
queryLineList()
|
||||
viewCallback?.setEnableSiteStatus(true)
|
||||
}else{
|
||||
} else {
|
||||
checkLine?.let {
|
||||
viewCallback?.setEnableSiteStatus(false)
|
||||
viewCallback?.lineAdapterSubmit(it)
|
||||
@@ -339,27 +346,28 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
|
||||
fun checkSiteClick(siteInfo: SiteInfoResponse.SiteInfo?) {
|
||||
tempCheckSite = siteInfo
|
||||
if(checkSite!=null){
|
||||
if (checkSite != null) {
|
||||
checkSite?.let {
|
||||
if (it.siteId == siteInfo?.siteId) {// 站点相同 隐藏所有提交按钮
|
||||
viewCallback?.setEnableSiteStatus(false)
|
||||
} else {
|
||||
if(it.lineId == siteInfo?.lineId){// 线路相同显示单独提交
|
||||
if (it.lineId == siteInfo?.lineId) {// 线路相同显示单独提交
|
||||
viewCallback?.setEnableSiteStatus(true)
|
||||
}else{
|
||||
if(siteInfo==null){//没有选站点隐藏所有提交
|
||||
} else {
|
||||
if (siteInfo == null) {//没有选站点隐藏所有提交
|
||||
viewCallback?.setEnableSiteStatus(false)
|
||||
}else {
|
||||
} else {
|
||||
viewCallback?.setEnableSiteStatus(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
viewCallback?.setEnableSiteStatus(true)
|
||||
}
|
||||
}
|
||||
fun canSwitchLine():Boolean {
|
||||
|
||||
fun canSwitchLine(): Boolean {
|
||||
val gnssSpeed =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed
|
||||
if (gnssSpeed < 0.5) {
|
||||
@@ -367,25 +375,30 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
return true
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
return true
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// 自动驾驶中
|
||||
return when (StopSideStatusManager.stopSiteStatus) {
|
||||
StopSideStatusManager.Status.EndingSuccess -> {
|
||||
true
|
||||
}
|
||||
else ->{
|
||||
|
||||
else -> {
|
||||
ToastCharterUtils.showShort("自动驾驶中无法切换线路")
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
ToastCharterUtils.showShort("因车辆正在平行驾驶中无法切换线路")
|
||||
return false
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
} else {
|
||||
@@ -412,6 +425,7 @@ class SelectLineViewModel : ViewModel(), IOrderStatusChangeListener {
|
||||
lineInfo: List<LineInfoResponse.LineInfo>,
|
||||
checkLine: LineInfoResponse.LineInfo?
|
||||
)
|
||||
|
||||
fun siteAdapterEnableIndex(index: Int)
|
||||
fun siteAdapterSetData(siteInfo: List<SiteInfoResponse.SiteInfo>)
|
||||
}
|
||||
|
||||
@@ -76,26 +76,21 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
|
||||
private val TAG = "OrderInfoView"
|
||||
|
||||
private var viewModel:SoftControlViewModel?=null
|
||||
private var viewModel: SoftControlViewModel? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
context, attributeSet, defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
var goneViewListener: IClearViewCallback?=null
|
||||
var goneViewListener: IClearViewCallback? = null
|
||||
|
||||
private var currentTemperature: Temperature? = null
|
||||
|
||||
@@ -106,12 +101,13 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
private var subscribeAnimator: Disposable? = null
|
||||
|
||||
private var animator1: ObjectAnimator? = null
|
||||
|
||||
private val loadingAni = ObjectAnimator.ofFloat(iv_loading, "rotation", 0f, 90f ,180f, 270f, 360f).apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
duration = 1000
|
||||
}
|
||||
|
||||
private val loadingAni =
|
||||
ObjectAnimator.ofFloat(iv_loading, "rotation", 0f, 90f, 180f, 270f, 360f).apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
duration = 1000
|
||||
}
|
||||
|
||||
|
||||
private fun initView() {
|
||||
@@ -121,7 +117,7 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
}
|
||||
}
|
||||
|
||||
private fun setViewGone(){
|
||||
private fun setViewGone() {
|
||||
goneViewListener?.goneAllView()
|
||||
}
|
||||
|
||||
@@ -136,28 +132,31 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
R.id.tv_setting_aircondition -> {
|
||||
g_light_setting.visibility = View.GONE
|
||||
g_voice_setting.visibility = View.GONE
|
||||
if(loadingAni.isRunning){
|
||||
if (loadingAni.isRunning) {
|
||||
iv_loading.visibility = View.VISIBLE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
}else{
|
||||
} else {
|
||||
g_aircondition_setting.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
R.id.tv_setting_lighting -> {
|
||||
g_light_setting.visibility = View.VISIBLE
|
||||
g_voice_setting.visibility = View.GONE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
iv_loading.visibility = View.GONE
|
||||
}
|
||||
|
||||
R.id.tv_setting_voice -> {
|
||||
g_voice_setting.visibility = View.VISIBLE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
g_light_setting.visibility = View.GONE
|
||||
iv_loading.visibility = View.GONE
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
if(rb_pattern_heating.isChecked){
|
||||
if (rb_pattern_heating.isChecked) {
|
||||
iv_temperature_select.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@@ -169,9 +168,9 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
}
|
||||
|
||||
|
||||
fun setWind(check: RadioButton, resource:Int){
|
||||
fun setWind(check: RadioButton, resource: Int) {
|
||||
check.isChecked = true
|
||||
dbv_wind.setDrawableImage(BitmapFactory.decodeResource(resources,resource))
|
||||
dbv_wind.setDrawableImage(BitmapFactory.decodeResource(resources, resource))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,18 +190,28 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
layoutManager.setHorizontallyScroll(enable)
|
||||
}
|
||||
val adapter = rv_aircondition_temperature.adapter as TemperatureAdapter
|
||||
if(enable){
|
||||
if (enable) {
|
||||
adapter.setEnable(true)
|
||||
if(tv_setting_aircondition.isChecked) {
|
||||
if(iv_loading.visibility==View.GONE){
|
||||
if (tv_setting_aircondition.isChecked) {
|
||||
if (iv_loading.visibility == View.GONE) {
|
||||
iv_temperature_select.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
rb_wind_speed_low.setTextColor(ContextCompat.getColorStateList(context,R.color.bus_p_function_airconditon_pattern_text_color_selector))
|
||||
}else{
|
||||
rb_wind_speed_low.setTextColor(
|
||||
ContextCompat.getColorStateList(
|
||||
context,
|
||||
R.color.bus_p_function_airconditon_pattern_text_color_selector
|
||||
)
|
||||
)
|
||||
} else {
|
||||
adapter.setEnable(false)
|
||||
iv_temperature_select.visibility = View.GONE
|
||||
rb_wind_speed_low.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_6647576e))
|
||||
rb_wind_speed_low.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
context,
|
||||
R.color.bus_p_m1_6647576e
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,12 +229,15 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
rb_wind_speed_middle.toggle()
|
||||
switch = 1
|
||||
}
|
||||
|
||||
R.id.rb_wind_speed_middle -> {
|
||||
switch = 1
|
||||
}
|
||||
|
||||
R.id.rb_wind_speed_high -> {
|
||||
switch = 2
|
||||
}
|
||||
|
||||
else -> {
|
||||
rb_wind_speed_middle.tag = M1SoftFragment.touchTag
|
||||
rb_wind_speed_middle.toggle()
|
||||
@@ -262,7 +274,7 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
viewModel?.closeAircondition(modeCmd, windSpeedCmd, temperatureCmd)
|
||||
}
|
||||
|
||||
fun showAni(){
|
||||
fun showAni() {
|
||||
iv_loading.visibility = View.VISIBLE
|
||||
loadingAni.target = iv_loading
|
||||
loadingAni.start()
|
||||
@@ -272,9 +284,9 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
.subscribe {
|
||||
loadingAni.cancel()
|
||||
iv_loading.visibility = View.GONE
|
||||
if(tv_setting_aircondition.isChecked){
|
||||
if (tv_setting_aircondition.isChecked) {
|
||||
g_aircondition_setting.visibility = View.VISIBLE
|
||||
if(rb_pattern_heating.isChecked){
|
||||
if (rb_pattern_heating.isChecked) {
|
||||
iv_temperature_select.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@@ -308,15 +320,14 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
viewModel?.openAndSetAircondition(modeCmd, windSpeedCmd, temperatureCmd)
|
||||
}
|
||||
|
||||
private fun setCheckAir(adapter: TemperatureAdapter, tag:Temperature){
|
||||
private fun setCheckAir(adapter: TemperatureAdapter, tag: Temperature) {
|
||||
adapter.setCheckIndex(tag.index)
|
||||
currentTemperature = tag
|
||||
if (rv_aircondition_temperature.tag == M1SoftFragment.touchTag) {
|
||||
rv_aircondition_temperature.tag = null
|
||||
return
|
||||
} else {
|
||||
SoundPoolHelper.getSoundPoolHelper()
|
||||
.playSoundWithRedId(context, R.raw.bus_di)
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
openAircondition()
|
||||
}
|
||||
@@ -325,89 +336,88 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
// region 灯
|
||||
private fun setLightListener(viewModel: SoftControlViewModel?) {
|
||||
tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(!buttonView.isPressed){
|
||||
if (!buttonView.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
tv_light_top_01.isEnabled = false
|
||||
subscribeLightTop1 = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
tv_light_top_01.isEnabled = true
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
viewModel?.setLightData1(isChecked)
|
||||
setLightTop1View(isChecked,true)
|
||||
setLightView(isChecked,tv_light_top_02.isChecked)
|
||||
setLightTop1View(isChecked, true)
|
||||
setLightView(isChecked, tv_light_top_02.isChecked)
|
||||
}
|
||||
tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(!buttonView.isPressed){
|
||||
if (!buttonView.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
tv_light_top_02.isEnabled = false
|
||||
subscribeLightTop2 = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
subscribeLightTop2 = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
tv_light_top_02.isEnabled = true
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
viewModel?.setLightData2(isChecked)
|
||||
setLightTop2View(isChecked,true)
|
||||
setLightView(tv_light_top_01.isChecked,isChecked)
|
||||
setLightTop2View(isChecked, true)
|
||||
setLightView(tv_light_top_01.isChecked, isChecked)
|
||||
}
|
||||
tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(!buttonView.isPressed){
|
||||
if (!buttonView.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
tv_light_atmosphere.isEnabled = false
|
||||
subscribeAtmosphere = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
tv_light_atmosphere.isEnabled = true
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
viewModel?.setAtmosphereLightData2(isChecked)
|
||||
setLightAtmosphereView(isChecked,true)
|
||||
setLightAtmosphereView(isChecked, true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLightTop1View(leftLight: Boolean, isFirst: Boolean){
|
||||
override fun setLightTop1View(leftLight: Boolean, isFirst: Boolean) {
|
||||
tv_light_top_01?.let {
|
||||
if (leftLight) {
|
||||
tv_light_top_01.text = context.getString(R.string.bus_p_m1_close_light1)
|
||||
tv_light_top_01.isChecked = true
|
||||
if(!isFirst) ToastCharterUtils.showShort("打开顶灯1")
|
||||
if (!isFirst) ToastCharterUtils.showShort("打开顶灯1")
|
||||
} else {
|
||||
tv_light_top_01.text = context.getString(R.string.bus_p_m1_open_light1)
|
||||
tv_light_top_01.isChecked = false
|
||||
if(!isFirst) ToastCharterUtils.showShort("关闭顶灯1")
|
||||
if (!isFirst) ToastCharterUtils.showShort("关闭顶灯1")
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun setLightTop2View(rightLight: Boolean, isFirst: Boolean){
|
||||
|
||||
override fun setLightTop2View(rightLight: Boolean, isFirst: Boolean) {
|
||||
tv_light_top_02?.let {
|
||||
if (rightLight) {
|
||||
tv_light_top_02.text = context.getString(R.string.bus_p_m1_close_light2)
|
||||
tv_light_top_02.isChecked = true
|
||||
if(!isFirst) ToastCharterUtils.showShort("打开顶灯2")
|
||||
if (!isFirst) ToastCharterUtils.showShort("打开顶灯2")
|
||||
} else {
|
||||
tv_light_top_02.text = context.getString(R.string.bus_p_m1_open_light2)
|
||||
tv_light_top_02.isChecked = false
|
||||
if(!isFirst) ToastCharterUtils.showShort("关闭顶灯2")
|
||||
if (!isFirst) ToastCharterUtils.showShort("关闭顶灯2")
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun setLightAtmosphereView(atmosphereLight: Boolean, isFirst: Boolean){
|
||||
|
||||
override fun setLightAtmosphereView(atmosphereLight: Boolean, isFirst: Boolean) {
|
||||
tv_light_atmosphere?.let {
|
||||
if (atmosphereLight) {
|
||||
tv_light_atmosphere.text = context.getString(R.string.bus_p_m1_close_atmosphere)
|
||||
tv_light_atmosphere.isChecked = true
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_select)
|
||||
if(!isFirst) ToastCharterUtils.showShort("打开氛围灯")
|
||||
if (!isFirst) ToastCharterUtils.showShort("打开氛围灯")
|
||||
} else {
|
||||
tv_light_atmosphere.text = context.getString(R.string.bus_p_m1_open_atmosphere)
|
||||
tv_light_atmosphere.isChecked = false
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor)
|
||||
if(!isFirst) ToastCharterUtils.showShort("关闭氛围灯")
|
||||
if (!isFirst) ToastCharterUtils.showShort("关闭氛围灯")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,7 +516,6 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
// endregion
|
||||
|
||||
|
||||
|
||||
private fun setAirConditionAni() {
|
||||
dbv_wind.post {
|
||||
dbv_wind?.let {
|
||||
@@ -514,7 +523,7 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
animator1 = ObjectAnimator.ofInt(it, "showHeight", 0, measuredHeight).apply {
|
||||
duration = 1000
|
||||
repeatCount = ValueAnimator.INFINITE
|
||||
if(rg_setting_windspeed.checkedRadioButtonId!=0&&tv_aircondition_switch.isChecked){
|
||||
if (rg_setting_windspeed.checkedRadioButtonId != 0 && tv_aircondition_switch.isChecked) {
|
||||
start()
|
||||
}
|
||||
}
|
||||
@@ -525,11 +534,11 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
private fun setAirconditionListener(viewModel: SoftControlViewModel?) {
|
||||
// 开关空调或暖风机
|
||||
tv_aircondition_switch.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(!buttonView.isPressed){
|
||||
if (!buttonView.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if(isChecked){//打开
|
||||
if (isChecked) {//打开
|
||||
tv_aircondition_switch.setText("关闭空调")
|
||||
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {
|
||||
openHeater()// 打开暖风机
|
||||
@@ -537,7 +546,7 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
openAircondition()// 打开空调
|
||||
}
|
||||
showAni()
|
||||
}else{// 关闭
|
||||
} else {// 关闭
|
||||
tv_aircondition_switch.setText("打开空调")
|
||||
closeHeater()// 关闭暖风机
|
||||
closeAircondition()//关闭空调
|
||||
@@ -548,38 +557,42 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + M1SoftFragment.TAG, "调节模式")
|
||||
when (checkedId) {
|
||||
R.id.rb_pattern_heating -> {
|
||||
if(!rb_pattern_heating.isPressed){
|
||||
if (!rb_pattern_heating.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
openHeater()
|
||||
}
|
||||
R.id.rb_pattern_automatic->{
|
||||
if(!rb_pattern_automatic.isPressed){
|
||||
|
||||
R.id.rb_pattern_automatic -> {
|
||||
if (!rb_pattern_automatic.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
openAircondition()
|
||||
}
|
||||
R.id.rb_pattern_refrigeration->{
|
||||
if(!rb_pattern_refrigeration.isPressed){
|
||||
|
||||
R.id.rb_pattern_refrigeration -> {
|
||||
if (!rb_pattern_refrigeration.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
openAircondition()
|
||||
}
|
||||
R.id.rb_pattern_ventilate->{
|
||||
if(!rb_pattern_ventilate.isPressed){
|
||||
|
||||
R.id.rb_pattern_ventilate -> {
|
||||
if (!rb_pattern_ventilate.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
openAircondition()
|
||||
}
|
||||
|
||||
else -> {
|
||||
openAircondition()
|
||||
}
|
||||
}
|
||||
if(tv_aircondition_switch.isChecked) {
|
||||
if (tv_aircondition_switch.isChecked) {
|
||||
showAni()
|
||||
}
|
||||
}
|
||||
@@ -587,21 +600,24 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
// 风速调节
|
||||
rg_setting_windspeed.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rb_wind_speed_low-> {
|
||||
if(!rb_wind_speed_low.isPressed){
|
||||
R.id.rb_wind_speed_low -> {
|
||||
if (!rb_wind_speed_low.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
}
|
||||
R.id.rb_wind_speed_middle-> {
|
||||
if(!rb_wind_speed_middle.isPressed){
|
||||
|
||||
R.id.rb_wind_speed_middle -> {
|
||||
if (!rb_wind_speed_middle.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
}
|
||||
R.id.rb_wind_speed_high-> {
|
||||
if(!rb_wind_speed_high.isPressed){
|
||||
|
||||
R.id.rb_wind_speed_high -> {
|
||||
if (!rb_wind_speed_high.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
@@ -611,12 +627,9 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
openAircondition()
|
||||
}
|
||||
}
|
||||
val pickerLayoutManager =
|
||||
PickerLayoutManager(
|
||||
context,
|
||||
PickerLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
val pickerLayoutManager = PickerLayoutManager(
|
||||
context, PickerLayoutManager.HORIZONTAL, false
|
||||
)
|
||||
pickerLayoutManager.isChangeAlpha = true
|
||||
pickerLayoutManager.scaleDownBy = 0.29f
|
||||
pickerLayoutManager.scaleDownDistance = 0.8f
|
||||
@@ -628,12 +641,12 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
rv_aircondition_temperature.layoutManager = pickerLayoutManager
|
||||
rv_aircondition_temperature.adapter = adapter
|
||||
HorizontalDecoration.distance = SharedPrefsMgr.getInstance(context).getInt(
|
||||
HorizontalDecoration.distancekey,0)
|
||||
HorizontalDecoration.distancekey, 0
|
||||
)
|
||||
val space = AutoSizeUtils.dp2px(context, 15f)
|
||||
rv_aircondition_temperature.addItemDecoration(
|
||||
HorizontalDecoration(
|
||||
space,
|
||||
data.size - 1
|
||||
space, data.size - 1
|
||||
)
|
||||
)
|
||||
|
||||
@@ -643,25 +656,24 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
val tag = view.tag
|
||||
if (tag is Temperature) {
|
||||
RxUtils.disposeSubscribe(subscribeAir)
|
||||
if(tag.index==0||tag.index==adapter.data.size-1){
|
||||
if (tag.index == 0 || tag.index == adapter.data.size - 1) {
|
||||
subscribeAir = Observable.timer(200, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
setCheckAir(adapter,tag)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
setCheckAir(adapter, tag)
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
if (ClickUtils.isClickTooFrequent(rv_aircondition_temperature)) {
|
||||
return@setOnScrollStopListener
|
||||
}
|
||||
setCheckAir(adapter,tag)
|
||||
setCheckAir(adapter, tag)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(HorizontalDecoration.distance!=0){
|
||||
rv_aircondition_temperature.scrollToPosition(data.size-1)
|
||||
adapter.setCheckIndex(data.size-1)
|
||||
if (HorizontalDecoration.distance != 0) {
|
||||
rv_aircondition_temperature.scrollToPosition(data.size - 1)
|
||||
adapter.setCheckIndex(data.size - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,11 +706,7 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
* 根据车的状态会写页面状态
|
||||
*/
|
||||
override fun setAirconditionHeaterView(
|
||||
airIsOpen: Boolean,
|
||||
heaterIsOpen: Boolean,
|
||||
temperatureCmd: Int,
|
||||
pattern: Int,
|
||||
windSpeed: Int
|
||||
airIsOpen: Boolean, heaterIsOpen: Boolean, temperatureCmd: Int, pattern: Int, windSpeed: Int
|
||||
) {
|
||||
tv_aircondition_switch?.let {
|
||||
if (!airIsOpen && !heaterIsOpen) {
|
||||
@@ -718,27 +726,39 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
rv_aircondition_temperature.tag = M1SoftFragment.touchTag
|
||||
UiThreadHandler.postDelayed({
|
||||
rv_aircondition_temperature?.smoothScrollToPosition(it.index)
|
||||
},500)
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
when (pattern) {//1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度)
|
||||
1 -> {rb_pattern_automatic.isChecked = true}
|
||||
2 -> {rb_pattern_refrigeration.isChecked = true}
|
||||
3 -> {rb_pattern_ventilate.isChecked = true}
|
||||
1 -> {
|
||||
rb_pattern_automatic.isChecked = true
|
||||
}
|
||||
|
||||
2 -> {
|
||||
rb_pattern_refrigeration.isChecked = true
|
||||
}
|
||||
|
||||
3 -> {
|
||||
rb_pattern_ventilate.isChecked = true
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
heaterAirEnable(true)
|
||||
when (windSpeed) {//1: 1档,2: 2档,3:3档
|
||||
1 -> {
|
||||
setWind(rb_wind_speed_low,R.drawable.bus_pm1_aircondition_wind_low)
|
||||
setWind(rb_wind_speed_low, R.drawable.bus_pm1_aircondition_wind_low)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
setWind(rb_wind_speed_middle,R.drawable.bus_pm1_aircondition_wind_middle)
|
||||
setWind(rb_wind_speed_middle, R.drawable.bus_pm1_aircondition_wind_middle)
|
||||
}
|
||||
|
||||
3 -> {
|
||||
setWind(rb_wind_speed_high,R.drawable.bus_pm1_aircondition_wind_high)
|
||||
setWind(rb_wind_speed_high, R.drawable.bus_pm1_aircondition_wind_high)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -747,11 +767,13 @@ class SoftControlView : ConstraintLayout, SoftControlViewModel.SoftControlCallba
|
||||
heaterAirEnable(false)
|
||||
when (windSpeed) {//1: 1档,2: 2档
|
||||
1 -> {
|
||||
setWind(rb_wind_speed_middle,R.drawable.bus_pm1_warm_wind_middle)
|
||||
setWind(rb_wind_speed_middle, R.drawable.bus_pm1_warm_wind_middle)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
setWind(rb_wind_speed_high,R.drawable.bus_pm1_warm_wind_high)
|
||||
setWind(rb_wind_speed_high, R.drawable.bus_pm1_warm_wind_high)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,18 +14,18 @@ import com.mogo.och.common.module.manager.devicemanage.data.LightStatus
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
class SoftControlViewModel : ViewModel(), LightAirconditionDoorCallback {
|
||||
|
||||
private val TAG = SoftControlViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:SoftControlCallback?=null
|
||||
private var viewCallback: SoftControlCallback? = null
|
||||
|
||||
private var subscribeLightTop1: Disposable?=null
|
||||
private var subscribeLightTop2: Disposable?=null
|
||||
private var subscribeLightAtmosphere: Disposable?=null
|
||||
private var subscribeLightTop1: Disposable? = null
|
||||
private var subscribeLightTop2: Disposable? = null
|
||||
private var subscribeLightAtmosphere: Disposable? = null
|
||||
|
||||
private var airconditionDisposable: Disposable?=null
|
||||
private var heaterDisposable: Disposable?=null
|
||||
private var airconditionDisposable: Disposable? = null
|
||||
private var heaterDisposable: Disposable? = null
|
||||
|
||||
|
||||
init {
|
||||
@@ -38,7 +38,7 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
LightAirconditionDoorStatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
fun setViewCallback(viewCallback:SoftControlCallback){
|
||||
fun setViewCallback(viewCallback: SoftControlCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
LightAirconditionDoorStatusManager.addListener(TAG, this)
|
||||
}
|
||||
@@ -46,14 +46,15 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
/**
|
||||
* 空调状态变化
|
||||
*/
|
||||
override fun onAirconditionStatusCallback(heaterIsOpen: Boolean, airconditionStatus: AirconditionStatus, isFirst: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
"回写--空调开关:${LightAirconditionDoorStatusManager.airconditionStatus.isOpen}、" +
|
||||
"空调温度:${LightAirconditionDoorStatusManager.airconditionStatus.temperature}" +
|
||||
"空调模式:${LightAirconditionDoorStatusManager.airconditionStatus.pattert}" +
|
||||
"空调风速:${LightAirconditionDoorStatusManager.airconditionStatus.windSpeed}")
|
||||
override fun onAirconditionStatusCallback(
|
||||
heaterIsOpen: Boolean, airconditionStatus: AirconditionStatus, isFirst: Boolean
|
||||
) {
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"回写--空调开关:${LightAirconditionDoorStatusManager.airconditionStatus.isOpen}、" + "空调温度:${LightAirconditionDoorStatusManager.airconditionStatus.temperature}" + "空调模式:${LightAirconditionDoorStatusManager.airconditionStatus.pattert}" + "空调风速:${LightAirconditionDoorStatusManager.airconditionStatus.windSpeed}"
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
if(airconditionStatus.isOpen){
|
||||
if (airconditionStatus.isOpen) {
|
||||
viewCallback?.setAirconditionHeaterView(
|
||||
airconditionStatus.isOpen,
|
||||
heaterIsOpen,
|
||||
@@ -61,79 +62,74 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
airconditionStatus.pattert,
|
||||
airconditionStatus.windSpeed
|
||||
)
|
||||
}else{
|
||||
} else {
|
||||
viewCallback?.setAirconditionHeaterView(
|
||||
airconditionStatus.isOpen,
|
||||
heaterIsOpen,
|
||||
airconditionStatus.temperature,
|
||||
0,
|
||||
0
|
||||
airconditionStatus.isOpen, heaterIsOpen, airconditionStatus.temperature, 0, 0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暖风机状态变化
|
||||
*/
|
||||
override fun onHeaterStatusCallback(airconditionIsOpen:Boolean, heaterStatue: HeaterStatue, isFirst: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
"回写--暖风机开关:${heaterStatue.isOpen}、" +
|
||||
"风速:${heaterStatue.windSpeed}")
|
||||
override fun onHeaterStatusCallback(
|
||||
airconditionIsOpen: Boolean, heaterStatue: HeaterStatue, isFirst: Boolean
|
||||
) {
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"回写--暖风机开关:${heaterStatue.isOpen}、" + "风速:${heaterStatue.windSpeed}"
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
if(heaterStatue.isOpen) {
|
||||
if (heaterStatue.isOpen) {
|
||||
viewCallback?.setAirconditionHeaterView(
|
||||
airconditionIsOpen,
|
||||
heaterStatue.isOpen,
|
||||
0,
|
||||
0,
|
||||
heaterStatue.windSpeed
|
||||
airconditionIsOpen, heaterStatue.isOpen, 0, 0, heaterStatue.windSpeed
|
||||
)
|
||||
}else{
|
||||
} else {
|
||||
viewCallback?.setAirconditionHeaterView(
|
||||
airconditionIsOpen,
|
||||
heaterStatue.isOpen,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
airconditionIsOpen, heaterStatue.isOpen, 0, 0, 0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 灯状态变化
|
||||
*/
|
||||
override fun onLightTop1Callback(lightStatus: LightStatus, isFirst: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" +
|
||||
"顶灯2开关:${lightStatus.isOpenLight2}、" +
|
||||
"氛围灯开关:${lightStatus.isOpenatmosphere}、")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" + "顶灯2开关:${lightStatus.isOpenLight2}、" + "氛围灯开关:${lightStatus.isOpenatmosphere}、"
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setLightTop1View(lightStatus.isOpenLight1,isFirst)
|
||||
viewCallback?.setLightTop1View(lightStatus.isOpenLight1, isFirst)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 灯状态变化
|
||||
*/
|
||||
override fun onLightTop2Callback(lightStatus: LightStatus, isFirst: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" +
|
||||
"顶灯2开关:${lightStatus.isOpenLight2}、" +
|
||||
"氛围灯开关:${lightStatus.isOpenatmosphere}、")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" + "顶灯2开关:${lightStatus.isOpenLight2}、" + "氛围灯开关:${lightStatus.isOpenatmosphere}、"
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setLightTop2View(lightStatus.isOpenLight2,isFirst)
|
||||
viewCallback?.setLightView(lightStatus.isOpenLight1,lightStatus.isOpenLight2)
|
||||
viewCallback?.setLightTop2View(lightStatus.isOpenLight2, isFirst)
|
||||
viewCallback?.setLightView(lightStatus.isOpenLight1, lightStatus.isOpenLight2)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 灯状态变化
|
||||
*/
|
||||
override fun onLightAtmosphereCallback(lightStatus: LightStatus, isFirst: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" +
|
||||
"顶灯2开关:${lightStatus.isOpenLight2}、" +
|
||||
"氛围灯开关:${lightStatus.isOpenatmosphere}、")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"回写--顶灯1开关:${lightStatus.isOpenLight1}、" + "顶灯2开关:${lightStatus.isOpenLight2}、" + "氛围灯开关:${lightStatus.isOpenatmosphere}、"
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setLightAtmosphereView(lightStatus.isOpenatmosphere,isFirst)
|
||||
viewCallback?.setLightAtmosphereView(lightStatus.isOpenatmosphere, isFirst)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,106 +137,111 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
* 设置空调
|
||||
*/
|
||||
fun openAndSetAircondition(modeCmd: Int, windSpeedCmd: Int, temperatureCmd: Int) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "" +
|
||||
"打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,temperatureCmd)
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG, "" + "打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd"
|
||||
)
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(
|
||||
1, modeCmd, windSpeedCmd, temperatureCmd
|
||||
)
|
||||
RxUtils.disposeSubscribe(airconditionDisposable)
|
||||
airconditionDisposable = RxUtils.createSubscribe(10000){
|
||||
if (!LightAirconditionDoorStatusManager.airconditionStatus.isOpen&&
|
||||
LightAirconditionDoorStatusManager.airconditionStatus.windSpeed!=windSpeedCmd&&
|
||||
LightAirconditionDoorStatusManager.airconditionStatus.temperature!=temperatureCmd&&
|
||||
LightAirconditionDoorStatusManager.airconditionStatus.pattert!=modeCmd) {
|
||||
airconditionDisposable = RxUtils.createSubscribe(10000) {
|
||||
if (!LightAirconditionDoorStatusManager.airconditionStatus.isOpen && LightAirconditionDoorStatusManager.airconditionStatus.windSpeed != windSpeedCmd && LightAirconditionDoorStatusManager.airconditionStatus.temperature != temperatureCmd && LightAirconditionDoorStatusManager.airconditionStatus.pattert != modeCmd) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun closeAircondition(modeCmd: Int, windSpeedCmd: Int, temperatureCmd: Int) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "关闭空调")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(2,modeCmd,windSpeedCmd,temperatureCmd)
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(
|
||||
2, modeCmd, windSpeedCmd, temperatureCmd
|
||||
)
|
||||
RxUtils.disposeSubscribe(airconditionDisposable)
|
||||
airconditionDisposable = RxUtils.createSubscribe(10000){
|
||||
airconditionDisposable = RxUtils.createSubscribe(10000) {
|
||||
if (LightAirconditionDoorStatusManager.airconditionStatus.isOpen) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置暖风
|
||||
*/
|
||||
fun openAndSetHeader(windSpeedCmd: Int) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "打开暖风机、档位${windSpeedCmd}")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(1,windSpeedCmd)
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(1, windSpeedCmd)
|
||||
RxUtils.disposeSubscribe(heaterDisposable)
|
||||
heaterDisposable = RxUtils.createSubscribe(10000){
|
||||
if (!LightAirconditionDoorStatusManager.heaterStatue.isOpen&&
|
||||
LightAirconditionDoorStatusManager.heaterStatue.windSpeed!=windSpeedCmd) {
|
||||
heaterDisposable = RxUtils.createSubscribe(10000) {
|
||||
if (!LightAirconditionDoorStatusManager.heaterStatue.isOpen && LightAirconditionDoorStatusManager.heaterStatue.windSpeed != windSpeedCmd) {
|
||||
ToastCharterUtils.showShort("暖风机操作未生效,请稍后重试吧~")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun closeHeader(){
|
||||
fun closeHeader() {
|
||||
CallerLogger.d(M_BUS_P + TAG, "关闭暖风机")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(2,0)
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(2, 0)
|
||||
RxUtils.disposeSubscribe(heaterDisposable)
|
||||
heaterDisposable = RxUtils.createSubscribe(10000){
|
||||
heaterDisposable = RxUtils.createSubscribe(10000) {
|
||||
if (LightAirconditionDoorStatusManager.heaterStatue.isOpen) {
|
||||
ToastCharterUtils.showShort("暖风机操作未生效,请稍后重试吧~")//还是开着的
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setLightData1(leftLight: Boolean){
|
||||
fun setLightData1(leftLight: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "顶灯2:$leftLight")
|
||||
RxUtils.disposeSubscribe(subscribeLightTop1)
|
||||
subscribeLightTop1 = if(leftLight){
|
||||
subscribeLightTop1 = if (leftLight) {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1MainLamp1Cmd(1)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (!LightAirconditionDoorStatusManager.lightStatus.isOpenLight1) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1MainLamp1Cmd(2)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (LightAirconditionDoorStatusManager.lightStatus.isOpenLight1) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun setLightData2(rightLight: Boolean){
|
||||
|
||||
fun setLightData2(rightLight: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "顶灯1:$rightLight")
|
||||
RxUtils.disposeSubscribe(subscribeLightTop2)
|
||||
subscribeLightTop2 = if(rightLight){
|
||||
subscribeLightTop2 = if (rightLight) {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1MainLamp2Cmd(1)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (!LightAirconditionDoorStatusManager.lightStatus.isOpenLight2) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1MainLamp2Cmd(2)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (LightAirconditionDoorStatusManager.lightStatus.isOpenLight2) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun setAtmosphereLightData2(atmosphereLight: Boolean){
|
||||
|
||||
fun setAtmosphereLightData2(atmosphereLight: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "氛围灯:$atmosphereLight")
|
||||
RxUtils.disposeSubscribe(subscribeLightAtmosphere)
|
||||
subscribeLightAtmosphere = if (atmosphereLight) {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1SmallLampCmd(1)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (!LightAirconditionDoorStatusManager.lightStatus.isOpenatmosphere) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1SmallLampCmd(2)
|
||||
RxUtils.createSubscribe{
|
||||
RxUtils.createSubscribe {
|
||||
if (LightAirconditionDoorStatusManager.lightStatus.isOpenatmosphere) {
|
||||
ToastCharterUtils.showShort("控制系统繁忙,请稍后再试")
|
||||
}
|
||||
@@ -249,8 +250,7 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface SoftControlCallback{
|
||||
interface SoftControlCallback {
|
||||
/**
|
||||
* 根据车的状态会写页面状态
|
||||
*/
|
||||
@@ -261,6 +261,7 @@ class SoftControlViewModel: ViewModel(), LightAirconditionDoorCallback {
|
||||
pattern: Int,
|
||||
windSpeed: Int
|
||||
)
|
||||
|
||||
fun setLightTop1View(leftLight: Boolean, isFirst: Boolean)
|
||||
fun setLightTop2View(rightLight: Boolean, isFirst: Boolean)
|
||||
fun setLightView(leftLight: Boolean, rightLight: Boolean)
|
||||
|
||||
@@ -288,7 +288,7 @@ public class CarouselLayoutManager extends RecyclerView.LayoutManager implements
|
||||
* <br />
|
||||
* This method may do relayout work.
|
||||
*
|
||||
* @param diff 要滚动的距离
|
||||
* @param diff 要滚动的距离
|
||||
* @param recycler 回收期
|
||||
* @param state Transient state of RecyclerView
|
||||
* @return distance that we actually scrolled by
|
||||
@@ -449,8 +449,8 @@ public class CarouselLayoutManager extends RecyclerView.LayoutManager implements
|
||||
private void detectOnItemSelectionChanged(final float currentScrollPosition, final RecyclerView.State state) {
|
||||
final float absCurrentScrollPosition = makeScrollPositionInRange0ToCount(currentScrollPosition, state.getItemCount());
|
||||
final int centerItem = Math.round(absCurrentScrollPosition);
|
||||
if(currentScrollPosition-centerItem!=0){
|
||||
new Handler(Looper.getMainLooper()).post(() -> dragDxDiff(currentScrollPosition,mCenterItemPosition));
|
||||
if (currentScrollPosition - centerItem != 0) {
|
||||
new Handler(Looper.getMainLooper()).post(() -> dragDxDiff(currentScrollPosition, mCenterItemPosition));
|
||||
}
|
||||
if (mCenterItemPosition != centerItem) {
|
||||
mCenterItemPosition = centerItem;
|
||||
@@ -468,9 +468,10 @@ public class CarouselLayoutManager extends RecyclerView.LayoutManager implements
|
||||
onCenterItemSelectionListener.onCenterItemChanged(centerItem);
|
||||
}
|
||||
}
|
||||
private void dragDxDiff(final float centerItem,final int currentPosition) {
|
||||
|
||||
private void dragDxDiff(final float centerItem, final int currentPosition) {
|
||||
for (final OnDargAutoDiffListener onDargAutoDiffListener : onDargAutoDiffListeners) {
|
||||
onDargAutoDiffListener.onDxChanged(centerItem,currentPosition);
|
||||
onDargAutoDiffListener.onDxChanged(centerItem, currentPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +523,7 @@ public class CarouselLayoutManager extends RecyclerView.LayoutManager implements
|
||||
view.setScaleY(transformation.mScaleY);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
view.setTransitionAlpha(transformation.mAlpha);
|
||||
}else {
|
||||
} else {
|
||||
view.setAlpha(transformation.mAlpha);
|
||||
}
|
||||
}
|
||||
@@ -804,7 +805,7 @@ public class CarouselLayoutManager extends RecyclerView.LayoutManager implements
|
||||
}
|
||||
|
||||
public interface OnDargAutoDiffListener {
|
||||
void onDxChanged(final float adapterPosition,final int currentPosition);
|
||||
void onDxChanged(final float adapterPosition, final int currentPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,14 +10,14 @@ import android.view.View
|
||||
import com.mogo.och.bus.passenger.R
|
||||
|
||||
|
||||
class DrawBitmapView @JvmOverloads constructor(
|
||||
class DrawBitmapView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : View(context, attrs, defStyleAttr) {
|
||||
private lateinit var mBitmap: Bitmap
|
||||
private lateinit var mBitPaint: Paint
|
||||
private var drawBitmapViewResource = R.drawable.bus_pm1_aircondition_wind_high
|
||||
private var drawBitmapViewResource = R.drawable.bus_pm1_aircondition_wind_high
|
||||
private var mBitWidth = 0
|
||||
private var showHeight = 0
|
||||
set(value) {
|
||||
@@ -27,13 +27,16 @@ class DrawBitmapView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.MainWindStatus)
|
||||
drawBitmapViewResource = typedArray.getResourceId(R.styleable.MainWindStatus_main_wind_drawable,R.drawable.bus_pm1_aircondition_wind_high)
|
||||
drawBitmapViewResource = typedArray.getResourceId(
|
||||
R.styleable.MainWindStatus_main_wind_drawable,
|
||||
R.drawable.bus_pm1_aircondition_wind_high
|
||||
)
|
||||
typedArray.recycle()
|
||||
initBitmap()
|
||||
initPaint()
|
||||
}
|
||||
|
||||
fun setDrawableImage(bitmap: Bitmap){
|
||||
fun setDrawableImage(bitmap: Bitmap) {
|
||||
mBitmap = bitmap
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ class DrawBitmapView @JvmOverloads constructor(
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
canvas.clipRect(0, 0, mBitWidth, showHeight)
|
||||
canvas.drawBitmap(mBitmap, (width-mBitmap.width)/2f, 0f, mBitPaint)
|
||||
canvas.drawBitmap(mBitmap, (width - mBitmap.width) / 2f, 0f, mBitPaint)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.mogo.och.bus.passenger.ui.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.TaxiPassengerVideoPlay
|
||||
import com.mogo.och.bus.passenger.callback.IClearViewCallback
|
||||
import com.mogo.och.bus.passenger.ui.softcontrol.layoutmanage.CarouselLayoutManager
|
||||
import com.mogo.och.bus.passenger.ui.softcontrol.layoutmanage.CarouselZoomPostLayoutListener
|
||||
import com.mogo.och.bus.passenger.ui.softcontrol.layoutmanage.CenterScrollListener
|
||||
import com.mogo.och.bus.passenger.ui.video.adapter.RecyclerVideoAdapter
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import kotlinx.android.synthetic.main.m1_video_fragment.view.rvVideoPlaylist
|
||||
import kotlin.math.floor
|
||||
|
||||
class VideoView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "DebugView"
|
||||
}
|
||||
|
||||
private val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
|
||||
|
||||
var goneViewListener: IClearViewCallback? = null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_video_fragment, this, true)
|
||||
onClick {
|
||||
goneViewListener?.goneAllView()
|
||||
}
|
||||
initConsultData()
|
||||
val carouselLayoutManager = CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true)
|
||||
carouselLayoutManager.setPostLayoutListener(CarouselZoomPostLayoutListener())
|
||||
carouselLayoutManager.maxVisibleItems = 1
|
||||
rvVideoPlaylist.addOnScrollListener(object : CenterScrollListener() {
|
||||
var prePlayerPosition = 0
|
||||
override fun pageSelect(recyclerView: RecyclerView?, newState: Int) {
|
||||
//播放视频
|
||||
val (centerItemPosition, player) = getPlayer(carouselLayoutManager)
|
||||
if (player is ConsultVideoPlayer) {
|
||||
if (prePlayerPosition != centerItemPosition) {
|
||||
if (player.currentState == GSYVideoView.CURRENT_STATE_PAUSE) {
|
||||
player.onVideoReset()
|
||||
}
|
||||
val playerHolder =
|
||||
carouselLayoutManager.findViewByPosition(prePlayerPosition)
|
||||
val prePlayer =
|
||||
playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
|
||||
prePlayer?.onVideoReset()
|
||||
} else {
|
||||
player.onVideoResume(false)
|
||||
}
|
||||
}
|
||||
prePlayerPosition = centerItemPosition
|
||||
}
|
||||
|
||||
override fun pageStop() {
|
||||
val (_, player) = getPlayer(carouselLayoutManager)
|
||||
if (player is ConsultVideoPlayer) {
|
||||
player.onVideoPause()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
carouselLayoutManager.addOnDargAutoDiffListener { adapterPosition, currentPosition ->
|
||||
val fl = adapterPosition - floor(adapterPosition)
|
||||
var currentIndex = currentPosition
|
||||
if (fl > 0.5) {
|
||||
if (currentPosition == 0) {
|
||||
currentIndex = rvVideoPlaylist?.adapter!!.itemCount - 1
|
||||
} else {
|
||||
currentIndex -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
val recyclerVideoAdapter = RecyclerVideoAdapter(context, arrayListOf, rvVideoPlaylist)
|
||||
recyclerVideoAdapter.setOnThumbImageClilckListener {
|
||||
val (_, player) = getPlayer(carouselLayoutManager)
|
||||
if (player is ConsultVideoPlayer) {
|
||||
player.onVideoReset()
|
||||
player.thumbImageViewLayout.visibility = View.VISIBLE
|
||||
}
|
||||
rvVideoPlaylist?.smoothScrollToPosition(it)
|
||||
}
|
||||
rvVideoPlaylist?.layoutManager = carouselLayoutManager
|
||||
rvVideoPlaylist?.setHasFixedSize(true)
|
||||
rvVideoPlaylist?.adapter = recyclerVideoAdapter
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
}
|
||||
|
||||
private fun getPlayer(carouselLayoutManager: CarouselLayoutManager): Pair<Int, ConsultVideoPlayer?> {
|
||||
val centerItemPosition: Int = carouselLayoutManager.centerItemPosition
|
||||
val playerHolder = carouselLayoutManager.findViewByPosition(centerItemPosition)
|
||||
val player = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
|
||||
return Pair(centerItemPosition, player)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
super.onVisibilityChanged(changedView, visibility)
|
||||
if (changedView != this) {
|
||||
return
|
||||
}
|
||||
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
|
||||
val (_, player) = getPlayer(carouselLayoutManager)
|
||||
when (visibility) {
|
||||
View.VISIBLE -> {}
|
||||
else -> {
|
||||
player?.let {
|
||||
if (!player.isIfCurrentIsFullscreen) {
|
||||
player.onVideoReset()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initConsultData() {
|
||||
arrayListOf.clear()
|
||||
arrayListOf.add(
|
||||
TaxiPassengerVideoPlay(
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708596763/全车型混剪增加红旗车队.m4v",
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969511280/车队.png",
|
||||
"蘑菇车联覆盖生活的方方面面"
|
||||
)
|
||||
)
|
||||
arrayListOf.add(
|
||||
TaxiPassengerVideoPlay(
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708554279/红旗车队.m4v",
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969553174/红旗重新排版.png",
|
||||
"蘑菇车联之红旗车队"
|
||||
)
|
||||
)
|
||||
arrayListOf.add(
|
||||
TaxiPassengerVideoPlay(
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708499497/大运会合作解说版.m4v",
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969536177/大运会.png",
|
||||
"蘑菇车联牵手成都大运会"
|
||||
)
|
||||
)
|
||||
arrayListOf.add(
|
||||
TaxiPassengerVideoPlay(
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708409810/20210610重新排版3屏.m4v",
|
||||
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969579713/三屏.png",
|
||||
"多视角体验蘑菇车联自动驾驶"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,37 +7,57 @@ import com.mogo.och.bus.passenger.ui.toast.ToastCharterView
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
object ToastCharterUtils {
|
||||
fun showTaost(toastText:String){
|
||||
const val TAG = "ToastCharterUtils"
|
||||
fun showTaost(toastText: String) {
|
||||
val context = ActivityUtils.getTopActivity()
|
||||
val marker = ToastCharterView(context)
|
||||
marker.setText(toastText)
|
||||
marker.measure(
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 145f), View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 34f), View.MeasureSpec.EXACTLY)
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 145f),
|
||||
View.MeasureSpec.UNSPECIFIED
|
||||
),
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 34f),
|
||||
View.MeasureSpec.EXACTLY
|
||||
)
|
||||
)
|
||||
marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight)
|
||||
ToastUtils.showShort(marker)
|
||||
}
|
||||
fun showLong(toastText:String){
|
||||
|
||||
fun showLong(toastText: String) {
|
||||
val context = ActivityUtils.getTopActivity()
|
||||
val marker = ToastCharterView(context)
|
||||
marker.setText(toastText)
|
||||
marker.measure(
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 145f), View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 34f), View.MeasureSpec.EXACTLY)
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 145f),
|
||||
View.MeasureSpec.UNSPECIFIED
|
||||
),
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 34f),
|
||||
View.MeasureSpec.EXACTLY
|
||||
)
|
||||
)
|
||||
marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight)
|
||||
ToastUtils.showLong(marker)
|
||||
}
|
||||
|
||||
fun showShort(toastText:String?){
|
||||
fun showShort(toastText: String?) {
|
||||
toastText?.let {
|
||||
val context = ActivityUtils.getTopActivity()
|
||||
val marker = ToastCharterView(context)
|
||||
marker.setText(toastText)
|
||||
marker.measure(
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 145f), View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(context, 34f), View.MeasureSpec.EXACTLY)
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 145f),
|
||||
View.MeasureSpec.UNSPECIFIED
|
||||
),
|
||||
View.MeasureSpec.makeMeasureSpec(
|
||||
AutoSizeUtils.dp2px(context, 34f),
|
||||
View.MeasureSpec.EXACTLY
|
||||
)
|
||||
)
|
||||
marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight)
|
||||
ToastUtils.showShort(marker)
|
||||
|
||||
@@ -1,43 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
android:id="@+id/mapBizView"
|
||||
android:layout_width="0dp"
|
||||
app:layout_constraintWidth_percent="0.662"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintWidth_percent="0.662" />
|
||||
|
||||
<com.mogo.eagle.core.function.view.OverMapView
|
||||
android:id="@+id/omvOverMap"
|
||||
app:mapStylePath="m1_style.data"
|
||||
app:mapStyleExtraPath="m1_style_extra.data"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:bottomPadding="200"
|
||||
app:carDrawable="@drawable/bug_p_overmap_car_model"
|
||||
app:isClearArrived="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:mapStyleExtraPath="m1_style_extra.data"
|
||||
app:mapStylePath="m1_style.data"
|
||||
app:resetDrawable="@drawable/bus_p_overmap_reset_size"
|
||||
app:carDrawable="@drawable/bug_p_overmap_car_model"
|
||||
app:startPointDrawable="@null"
|
||||
app:resetDrawableMarginRight="34dp"
|
||||
app:resetDrawableMarginBottom="54dp"
|
||||
app:bottomPadding="200"
|
||||
app:topPadding="100"
|
||||
app:isClearArrived="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"/>
|
||||
app:resetDrawableMarginRight="34dp"
|
||||
app:startPointDrawable="@null"
|
||||
app:topPadding="100" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/aciv_map_2_default"
|
||||
android:layout_width="@dimen/dp_148"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:src="@drawable/bus_p_overmap_reset"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
android:layout_width="@dimen/dp_148"
|
||||
android:layout_height="@dimen/dp_150"/>
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--V2X预警红色边框-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
|
||||
@@ -57,68 +58,23 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.itinerary.ItineraryView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.orderinfo.OrderInfoView
|
||||
android:id="@+id/biz_orderinfo"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="0dp"
|
||||
android:paddingBottom="@dimen/dp_34_5"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.softcontrol.SoftControlView
|
||||
android:id="@+id/biz_softcontrol"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="@dimen/dp_34_5"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.selectline.SelectLineView
|
||||
android:id="@+id/biz_selectline"
|
||||
android:layout_width="0dp"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="@dimen/dp_34_5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.bottom.BottomBar
|
||||
android:id="@+id/bb_boorombar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
|
||||
<!--消息盒子选择入口-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
|
||||
android:id="@+id/viewBusPM1MsgBoxButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_enter_video"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_149"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:src="@drawable/charter_p_video"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_149"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
|
||||
<!--消息盒子打开视图-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxListView
|
||||
@@ -126,8 +82,8 @@
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="520dp"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginEnd="@dimen/dp_34"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBusPM1MsgBoxButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
|
||||
@@ -140,14 +96,61 @@
|
||||
android:layout_marginEnd="@dimen/dp_34"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBusPM1MsgBoxButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.itinerary.ItineraryView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.orderinfo.OrderInfoView
|
||||
android:id="@+id/biz_orderinfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:paddingBottom="@dimen/dp_34_5"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.softcontrol.SoftControlView
|
||||
android:id="@+id/biz_softcontrol"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.selectline.SelectLineView
|
||||
android:id="@+id/biz_selectline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:paddingBottom="@dimen/dp_34_5"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.video.VideoView
|
||||
android:id="@+id/biz_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.bottom.BottomBar
|
||||
android:id="@+id/bb_boorombar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_107"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.debugview.DebugView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_47"
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_47"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/m1_function_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -9,6 +10,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:clickable="true"
|
||||
android:layout_marginBottom="@dimen/dp_141_5"
|
||||
android:background="@drawable/bus_p_function_setting_soft_b_shape"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="3:1"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/m1_function_bg"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@@ -9,6 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="731dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="@dimen/dp_141_5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -295,7 +295,7 @@ object BusPassengerModel{
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(),
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
|
||||
@@ -1272,7 +1272,7 @@ public class OrderModel {
|
||||
parameters.vehicleType = VEHICLE_TYPE;
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.getLineId(),
|
||||
busRoutesResult.getLineId(), busRoutesResult.getName(),
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BusTrajectoryManager {
|
||||
private Disposable mSendReqDisposable = null;
|
||||
|
||||
public BusTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
@@ -108,7 +108,8 @@ public class BusTrajectoryManager {
|
||||
return;
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(routesResult.getLineId(),
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
routesResult.getLineId(), routesResult.getName(),
|
||||
routesResult.csvFileUrl, routesResult.csvFileMd5,
|
||||
routesResult.txtFileUrl, routesResult.txtFileMd5,
|
||||
routesResult.contrailSaveTime, routesResult.carModel,
|
||||
@@ -117,6 +118,7 @@ public class BusTrajectoryManager {
|
||||
routesResult.contrailSaveTimeDPQP);
|
||||
} else {
|
||||
mAutoPilotLine.setLineId(routesResult.getLineId());
|
||||
mAutoPilotLine.setLineName(routesResult.getName());
|
||||
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
|
||||
mAutoPilotLine.setTrajMd5(routesResult.csvFileMd5);
|
||||
mAutoPilotLine.setStopUrl(routesResult.txtFileUrl);
|
||||
@@ -135,6 +137,7 @@ public class BusTrajectoryManager {
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
@@ -184,25 +187,6 @@ public class BusTrajectoryManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 2022/6/24
|
||||
// test1
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
|
||||
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
// test2
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2022/10/9
|
||||
@@ -55,7 +54,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
|
||||
}
|
||||
|
||||
public String getAutopilotUnAbilityReason(){
|
||||
return unableAutopilotReasons.toString();//TODO 临时toString 需要拼接数据
|
||||
return unableAutopilotReasons == null ? "" : unableAutopilotReasons.toString();//TODO 临时toString 需要拼接数据
|
||||
}
|
||||
|
||||
public String getStartFailedCode() {
|
||||
|
||||
@@ -1342,7 +1342,7 @@ public class OrderModel {
|
||||
parameters.vehicleType = VEHICLE_TYPE;
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.getLineId(),
|
||||
busRoutesResult.getLineId(), busRoutesResult.getName(),
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BusTrajectoryManager {
|
||||
private Disposable mSendReqDisposable = null;
|
||||
|
||||
public BusTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
@@ -107,7 +107,8 @@ public class BusTrajectoryManager {
|
||||
return;
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(routesResult.getLineId(),
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
routesResult.getLineId(), routesResult.getName(),
|
||||
routesResult.csvFileUrl, routesResult.csvFileMd5,
|
||||
routesResult.txtFileUrl, routesResult.txtFileMd5,
|
||||
routesResult.contrailSaveTime, routesResult.carModel,
|
||||
@@ -116,6 +117,7 @@ public class BusTrajectoryManager {
|
||||
routesResult.contrailSaveTimeDPQP);
|
||||
} else {
|
||||
mAutoPilotLine.setLineId(routesResult.getLineId());
|
||||
mAutoPilotLine.setLineName(routesResult.getName());
|
||||
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
|
||||
mAutoPilotLine.setTrajMd5(routesResult.csvFileMd5);
|
||||
mAutoPilotLine.setStopUrl(routesResult.txtFileUrl);
|
||||
@@ -134,6 +136,7 @@ public class BusTrajectoryManager {
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
@@ -183,25 +186,6 @@ public class BusTrajectoryManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 2022/6/24
|
||||
// test1
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
|
||||
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
// test2
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
parameters.vehicleType = 10;
|
||||
MessagePad.Line line = routeInfo.getLine();
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
line.getLineId(),
|
||||
line.getLineId(), line.getLineName(),
|
||||
line.getTrajUrl(), line.getTrajMd5(),
|
||||
line.getStopUrl(), line.getStopMd5(),
|
||||
line.getTimestamp(), line.getVehicleModel(),
|
||||
|
||||
@@ -518,7 +518,7 @@ public class SweeperTaskModel {
|
||||
.AutoPilotLonLat(mCurrentSubTaskDetail.getEndSiteWgs64Lat(), mCurrentSubTaskDetail.getEndSiteWgs64Lon());
|
||||
parameters.vehicleType = VEHICLE_TYPE;
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
mCurrentSubTaskDetail.getLineId(),
|
||||
mCurrentSubTaskDetail.getLineId(), mCurrentSubTaskDetail.getLineName(),
|
||||
mCurrentSubTaskDetail.getCsvFileUrl(), mCurrentSubTaskDetail.getCsvFileMd5(),
|
||||
mCurrentSubTaskDetail.getTxtFileUrl(), mCurrentSubTaskDetail.getTxtFileMd5(),
|
||||
mCurrentSubTaskDetail.getPublishTime(), mCurrentSubTaskDetail.getCarModel(),
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SweeperTrajectoryManager {
|
||||
private Disposable mSendReqDisposable = null;
|
||||
|
||||
public SweeperTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
@@ -99,7 +99,8 @@ public class SweeperTrajectoryManager {
|
||||
CallerLogger.INSTANCE.e(M_SWEEPER + TAG, "setupAutoPilotLine(): routesResult is null.");
|
||||
return;
|
||||
} else {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(subTaskDetail.getLineId(),
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
subTaskDetail.getLineId(), subTaskDetail.getLineName(),
|
||||
subTaskDetail.getCsvFileUrl(), subTaskDetail.getCsvFileMd5(),
|
||||
subTaskDetail.getTxtFileUrl(), subTaskDetail.getTxtFileMd5(),
|
||||
subTaskDetail.getPublishTime(), subTaskDetail.getCarModel(),
|
||||
@@ -112,6 +113,7 @@ public class SweeperTrajectoryManager {
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
@@ -161,25 +163,6 @@ public class SweeperTrajectoryManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 2022/6/24
|
||||
// test1
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
|
||||
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
// test2
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
|
||||
@@ -14,7 +14,9 @@ data class OrderDetail(
|
||||
var orderEndSite: Site?,
|
||||
var planningLines: Array<Long>,
|
||||
var phone: String,
|
||||
var passengerNum: Int
|
||||
var passengerNum: Int,
|
||||
var fullMinutes: Long, //单独接口查询到
|
||||
var mileage: Long // 单独接口查询到
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
@@ -108,10 +110,14 @@ data class QueryCarOrderByNoRespBean(
|
||||
data class ContrailListRespBean(var data: MutableList<Result>?) //轨迹路线集合
|
||||
: BaseData() {
|
||||
data class Result(
|
||||
var lineId: Long, var csvFileUrl: String, var csvFileMd5: String,
|
||||
var lineId: Long,var lineName: String, var csvFileUrl: String, var csvFileMd5: String,
|
||||
var txtFileUrl: String, var txtFileMd5: String, var contrailSaveTime: Long,
|
||||
var csvFileUrlDPQP: String, var csvFileMd5DPQP: String, var txtFileUrlDPQP: String,
|
||||
var txtFileMd5DPQP: String, var contrailSaveTimeDPQP: Long
|
||||
)
|
||||
}
|
||||
|
||||
data class QueryLineInfoRespBean(
|
||||
var id: Long, var fullMinutes: Long, var mileage: Long
|
||||
): BaseData()
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ object TaxiModel {
|
||||
&& mCurrentTaskAndOrder!!.endSite != null
|
||||
}
|
||||
|
||||
fun checkCurrentOrder(): Boolean {
|
||||
private fun checkCurrentOrder(): Boolean {
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order != null
|
||||
}
|
||||
|
||||
@@ -458,8 +458,8 @@ object TaxiModel {
|
||||
false,
|
||||
mCurrentTaskAndOrder!!.startSite!!.siteName,
|
||||
mCurrentTaskAndOrder!!.endSite!!.siteName,
|
||||
mCurrentTaskAndOrder!!.lineId.toLong(),
|
||||
"" // todo 这里原来传的是订单号, 现在是任务没有订单号
|
||||
mCurrentTaskAndOrder!!.lineId,
|
||||
if (mCurrentTaskAndOrder!!.order != null) mCurrentTaskAndOrder!!.order!!.orderNo else ""
|
||||
)
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback!!.startOpenAutopilot()
|
||||
@@ -497,7 +497,7 @@ object TaxiModel {
|
||||
mCurTaskContrail!!.txtFileUrl,
|
||||
mCurTaskContrail!!.txtFileMd5,
|
||||
mCurTaskContrail!!.contrailSaveTime,
|
||||
"", // todo 这里原来传的是carModel, 现在没有这个信息, 是否传businessType
|
||||
"", // todo 这里原来传的是carModel, 现在没有这个信息
|
||||
mCurTaskContrail!!.csvFileUrlDPQP,
|
||||
mCurTaskContrail!!.csvFileMd5DPQP,
|
||||
mCurTaskContrail!!.txtFileUrlDPQP,
|
||||
@@ -541,7 +541,6 @@ object TaxiModel {
|
||||
d(SceneConstant.M_TAXI + TAG, "onIntentReceived = %s", intentStr)
|
||||
if ((ConnectivityManager.CONNECTIVITY_ACTION == intentStr)) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
// startOrStopOrderLoop(isLogin() && isOpeningOrderStatus())
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
}
|
||||
}
|
||||
@@ -716,7 +715,7 @@ object TaxiModel {
|
||||
/**
|
||||
* 查询当前任务的轨迹
|
||||
*/
|
||||
public fun queryTaskContrail(planningLines: Array<Long>?) {
|
||||
fun queryTaskContrail(planningLines: Array<Long>?) {
|
||||
if (planningLines == null) return
|
||||
CarServiceManager.contrailList(mContext!!, planningLines,
|
||||
object : OchCommonServiceCallback<ContrailListRespBean> {
|
||||
@@ -731,7 +730,13 @@ object TaxiModel {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun setArriveAtUntruthStation() {
|
||||
if (mUntruthTask == null) {
|
||||
ToastUtils.showShort("无虚拟站点!")
|
||||
return
|
||||
}
|
||||
arriveSite(mUntruthTask!!.siteId, false)
|
||||
}
|
||||
/**
|
||||
* 订单流转debug START
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.och.taxi.base.IUiIntent
|
||||
import com.mogo.och.taxi.bean.ContrailListRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCarOrderByNoRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryLineInfoRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
@@ -28,6 +29,7 @@ import com.mogo.och.taxi.network.CarServiceManager
|
||||
import com.mogo.och.taxi.network.CarServiceManager.cancelOrder
|
||||
import com.mogo.och.taxi.network.CarServiceManager.contrailList
|
||||
import com.mogo.och.taxi.network.CarServiceManager.queryCarOrderByOrderNo
|
||||
import com.mogo.och.taxi.network.CarServiceManager.queryLineInfo
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskAndOrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedState
|
||||
@@ -74,7 +76,7 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
|
||||
is UnmannedIntent.CloseOrderByDriver -> {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order != null){
|
||||
val site = mCurrentTaskAndOrder!!.order!!.orderEndSite;
|
||||
val site = mCurrentTaskAndOrder!!.order!!.orderEndSite
|
||||
TaxiModel.arriveSite(site!!.siteId,true)
|
||||
}
|
||||
}
|
||||
@@ -149,7 +151,9 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
TaxiModel.loginService!!.queryLoginStatusByNet()
|
||||
VoiceNotice.showNotice("开始接单啦")
|
||||
//虚拟任务要开启到站围栏
|
||||
updateUntruthTask(data.data)
|
||||
if (mCurrentTaskAndOrder == null || mCurrentTaskAndOrder!!.endSite == null){
|
||||
updateUntruthTask(data.data)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
@@ -318,6 +322,10 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
if (data!!.orderStatus == TaxiOrderStatusEnum.Cancel.code){
|
||||
VoiceNotice.showNotice("乘客已经取消")
|
||||
updateNoTaskAndOrderCancelUi()
|
||||
return
|
||||
}
|
||||
if (data.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code){//到站
|
||||
queryRouteInfo()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +336,28 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站后查询总里程和总用时
|
||||
*/
|
||||
private fun queryRouteInfo() {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null)
|
||||
queryLineInfo(mContext, mCurrentTaskAndOrder!!.lineId,
|
||||
object : OchCommonServiceCallback<QueryLineInfoRespBean>{
|
||||
override fun onSuccess(data: QueryLineInfoRespBean?) {
|
||||
if (data == null || data.code != 0) return
|
||||
mCurrentTaskAndOrder?.order?.orderStatus = TaxiOrderStatusEnum.ArriveAtEnd.code
|
||||
mCurrentTaskAndOrder?.order?.fullMinutes = data.fullMinutes
|
||||
mCurrentTaskAndOrder?.order?.mileage = data.mileage
|
||||
updateTaskAndOrderUi()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private fun startInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable!!.isDisposed) {
|
||||
|
||||
@@ -172,4 +172,14 @@ object CarServiceManager {
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "contrailList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站查询总里程和总用时
|
||||
*/
|
||||
fun queryLineInfo(context: Context,lineId: Long,callback: OchCommonServiceCallback<QueryLineInfoRespBean>?){
|
||||
mOCHTaxiServiceApi.queryTaxiLineInfoById(lineId = lineId)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "contrailList"))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCarOrderByNoReqBean
|
||||
import com.mogo.och.taxi.bean.QueryCarOrderByNoRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryLineInfoRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceReqBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.bean.StartTaskReqBean
|
||||
@@ -149,4 +150,15 @@ interface UnmannedTaskServiceApi {
|
||||
@Header("ticket") ticket: String = MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Body data: QueryCarOrderByNoReqBean?
|
||||
): Observable<QueryCarOrderByNoRespBean>
|
||||
|
||||
/**
|
||||
* 查询总用时和里程
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-taxi-cabin/api/business/v1/queryTaxiLineById")
|
||||
fun queryTaxiLineInfoById(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Query("id") lineId: Long?
|
||||
): Observable<QueryLineInfoRespBean>
|
||||
}
|
||||
@@ -125,7 +125,6 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
return@collect
|
||||
}
|
||||
|
||||
isHaveBeingOrder(true)
|
||||
if (taskAndOrderUiState.untruthTask != null){
|
||||
updateUntruthTask(taskAndOrderUiState.untruthTask)
|
||||
}else{
|
||||
@@ -149,6 +148,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
private fun updateUntruthTask(untruthTask: StartServiceRespBean.Result?) {
|
||||
if (untruthTask == null) return
|
||||
isHaveBeingOrder(true)
|
||||
updateUntruthTaskView()
|
||||
updateUntruthTaskUIData(untruthTask.siteName)
|
||||
updateUntruthTaskOtherInfo()
|
||||
@@ -169,7 +169,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
private fun updateUntruthTaskView() {
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.GONE
|
||||
orderPhoneAndNum.visibility = View.GONE
|
||||
startStationName.visibility = View.VISIBLE
|
||||
endStationName.visibility = View.VISIBLE
|
||||
@@ -197,7 +197,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
&& mCurrentTaskAndOrder!!.currentStatus == TaskStatusEnum.StartTask.code){
|
||||
|
||||
startNaviToStation(isVoicePlay,mCurrentTaskAndOrder!!.endSite!!.gcjLat,
|
||||
mCurrentTaskAndOrder!!.endSite!!.gcjLat)
|
||||
mCurrentTaskAndOrder!!.endSite!!.gcjLon)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
&& mCurrentTaskAndOrder!!.currentStatus == TaskStatusEnum.GetTask.code){ //演练任务和送驾任务
|
||||
|
||||
startNaviToStation(isVoicePlay,mCurrentTaskAndOrder!!.startSite!!.gcjLat,
|
||||
mCurrentTaskAndOrder!!.startSite!!.gcjLat)
|
||||
mCurrentTaskAndOrder!!.startSite!!.gcjLon)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +219,12 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
isHaveBeingOrder(false)
|
||||
return
|
||||
}
|
||||
|
||||
if (taskAndOrder.currentStatus == TaskStatusEnum.CompleteTask.code){
|
||||
isHaveBeingOrder(false)
|
||||
return
|
||||
}
|
||||
|
||||
isHaveBeingOrder(true)
|
||||
/**
|
||||
* 根据任务类型判断任务显示,
|
||||
@@ -235,7 +241,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
updateUIShowStatus(taskType,currentStatus,order)
|
||||
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code -> {// 送驾驶任务
|
||||
TaskTypeEnum.VirtualTask.code -> {// 演练任务
|
||||
if (startSite == null || endSite == null) return
|
||||
taskStatus.text = resources.getString(R.string.task_start_end_site)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_unreal_type_btn_bg,null)
|
||||
@@ -512,7 +518,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateDistanceAndTime(meters: Long, timeInSecond: Long) {
|
||||
// CallerLogger.INSTANCE.d(M_TAXI + TAG,"meters = "+meters+"timeInSecond ="+timeInSecond);
|
||||
if (mCurrentTaskAndOrder == null || mCurrentTaskAndOrder!!.order == null) return
|
||||
if (mCurrentTaskAndOrder == null || mCurrentTaskAndOrder!!.endSite == null) return
|
||||
var dis = "0"
|
||||
var disUnit = "公里"
|
||||
if (meters > 0) {
|
||||
@@ -528,6 +534,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
val strHtml2 =
|
||||
("<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)
|
||||
}
|
||||
|
||||
private fun speekVoice200mTipsOnce() {
|
||||
|
||||
@@ -197,6 +197,9 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
* 订单流转debug START
|
||||
*/
|
||||
private fun initOrderTestBar() {
|
||||
findViewById<View>(R.id.test_bar_to_virtual)?.setOnClickListener{
|
||||
TaxiModel.setArriveAtUntruthStation()
|
||||
}
|
||||
findViewById<View>(R.id.test_bar_to_start)?.setOnClickListener {
|
||||
TaxiModel.setArriveAtStartStation()
|
||||
}
|
||||
@@ -227,10 +230,11 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun openOperationalInfoView(eventLogout: EventLogout) {
|
||||
if (eventLogout.messgae == EventLogout.PERSONAL_TYPE) {
|
||||
d(SceneConstant.M_TAXI + TAG, "openOperationalInfoView Event个人中心")
|
||||
openOperationalInfoView()
|
||||
}
|
||||
// if (eventLogout.messgae == EventLogout.PERSONAL_TYPE) {
|
||||
// 个人信息, 运营数据在无人化阶段暂时不展示
|
||||
// d(SceneConstant.M_TAXI + TAG, "openOperationalInfoView Event个人中心")
|
||||
// openOperationalInfoView()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun openOperationalInfoView() {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 12 KiB |
@@ -66,6 +66,13 @@
|
||||
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_to_start"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
android:id="@+id/greenPoint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/green_point"
|
||||
android:src="@drawable/taxi_driver_circle_green_big"
|
||||
app:layout_constraintTop_toTopOf="@+id/startStationName"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/startStationName"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"/>
|
||||
|
||||
@@ -75,7 +75,7 @@ internal class AccessSyntheticUtils {
|
||||
val ret = when (t) {
|
||||
is View -> {
|
||||
lifecycle = t.lifecycleOwner.lifecycle
|
||||
ViewCompat.isAttachedToWindow(t)
|
||||
t.parent == null || ViewCompat.isAttachedToWindow(t)
|
||||
}
|
||||
is Activity -> {
|
||||
lifecycle = t.findViewById<View>(android.R.id.content)?.lifecycleOwner?.lifecycle
|
||||
|
||||
@@ -121,8 +121,9 @@ class DispatchAutoPilotManager private constructor() :
|
||||
//同步调用路线下载逻辑
|
||||
adasAutoPilotLocReceiverBean?.let {
|
||||
if(it.type == 1){
|
||||
val mAutoPilotLine = AutopilotControlParameters.AutoPilotLine(it.lineId.toLong(),it.trajUrl,it.trajMd5,it.stopUrl,it.stopMd5,it.timestamp,
|
||||
it.vehicleModel,it.trajUrl_dpqp,it.trajMd5_dpqp,it.stopUrl_dpqp,it.stopMd5_dpqp,it.timestamp_dpqp)
|
||||
val mAutoPilotLine = AutopilotControlParameters.AutoPilotLine(it.lineId.toLong(), it.lineName,
|
||||
it.trajUrl,it.trajMd5,it.stopUrl,it.stopMd5,it.timestamp, it.vehicleModel,
|
||||
it.trajUrl_dpqp,it.trajMd5_dpqp,it.stopUrl_dpqp,it.stopMd5_dpqp,it.timestamp_dpqp)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(mAutoPilotLine)
|
||||
CallerLogger.i("$M_BIZ$TAG","调用路线下载逻辑")
|
||||
}
|
||||
@@ -176,7 +177,7 @@ class DispatchAutoPilotManager private constructor() :
|
||||
ToastUtils.showShort("endLocAddress数据为空")
|
||||
return
|
||||
}
|
||||
val currentAutoPilotLine = AutopilotControlParameters.AutoPilotLine(it.lineId.toLong(),it.trajUrl,it.trajMd5,
|
||||
val currentAutoPilotLine = AutopilotControlParameters.AutoPilotLine(it.lineId.toLong(),it.lineName,it.trajUrl,it.trajMd5,
|
||||
it.stopUrl,it.stopMd5,it.timestamp,it.vehicleModel,it.trajUrl_dpqp+"",it.trajMd5_dpqp+"",it.stopUrl_dpqp+"",
|
||||
it.stopMd5_dpqp,it.timestamp_dpqp)
|
||||
currentAutopilot.autoPilotLine = currentAutoPilotLine
|
||||
|
||||
@@ -5,7 +5,9 @@ import android.util.Log
|
||||
import com.amap.api.maps.CoordinateConverter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils.getAngleDiff
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils.getLineAngle
|
||||
import com.mogo.eagle.core.utilcode.util.LocationUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -132,54 +134,94 @@ object MarkerDrawerManager {
|
||||
var currentIndex = 0 //记录疑似点
|
||||
// 是否超过200KM
|
||||
var isLongDistance = false
|
||||
if (routePoints.isNotEmpty()) {
|
||||
//基础点
|
||||
val baseLatLng = routePoints[0]
|
||||
newPoints.add(LatLng(baseLatLng.latitude, baseLatLng.longitude))
|
||||
var baseDiffDis = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, baseLatLng.longitude, baseLatLng.latitude
|
||||
) // lon,lat, prelon, prelat
|
||||
if (baseDiffDis > 200000) {
|
||||
isLongDistance = true
|
||||
}
|
||||
val size = routePoints.size
|
||||
for (i in 1 until size) {
|
||||
val latLng = routePoints[i]
|
||||
// 深拷贝数据用于高德地图上轨迹线的绘制
|
||||
newPoints.add(LatLng(latLng.latitude, latLng.longitude))
|
||||
if (isLongDistance) continue
|
||||
val diff = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, latLng.longitude, latLng.latitude
|
||||
)
|
||||
if (baseDiffDis > diff) {
|
||||
baseDiffDis = diff
|
||||
// 距离最近的时候判断是否走过
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(
|
||||
realLon,
|
||||
realLat,
|
||||
var distance = 0.0
|
||||
var tmpDistance: Double
|
||||
var angle = 0.0
|
||||
routePoints.forEachIndexed { index, latLng ->
|
||||
newPoints.add(LatLng(latLng.latitude, latLng.longitude))
|
||||
when (index) {
|
||||
0 -> {
|
||||
distance = LocationUtils.pointToLine(
|
||||
latLng.longitude,
|
||||
latLng.latitude,
|
||||
routePoints[index + 1].longitude,
|
||||
routePoints[index + 1].latitude,
|
||||
realLon,
|
||||
realLat
|
||||
)
|
||||
if (distance > 200000) {
|
||||
isLongDistance = true
|
||||
}
|
||||
}
|
||||
|
||||
routePoints.size - 1 -> {}
|
||||
else -> {
|
||||
// 车到两轨迹点距离最短(距离这条路最近)
|
||||
tmpDistance = LocationUtils.pointToLine(
|
||||
latLng.longitude,
|
||||
latLng.latitude,
|
||||
routePoints[index + 1].longitude,
|
||||
routePoints[index + 1].latitude,
|
||||
realLon,
|
||||
realLat
|
||||
)
|
||||
if (tmpDistance <= distance) {
|
||||
// 车此刻运动方向与两轨迹点朝向的夹角小于90(结合距离线段最近则车在两点之间,意味着已走过第index个轨迹点)
|
||||
angle = getLineAngle(
|
||||
latLng.longitude,
|
||||
latLng.latitude,
|
||||
heading
|
||||
) >= 90
|
||||
) {
|
||||
currentIndex = i
|
||||
routePoints[index + 1].longitude,
|
||||
routePoints[index + 1].latitude
|
||||
)
|
||||
if (getAngleDiff(angle, heading) < 90) {
|
||||
if (index < currentIndex) {
|
||||
return@forEachIndexed
|
||||
} else {
|
||||
distance = tmpDistance
|
||||
currentIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("MarkerDrawerManager", "当次计算已走过的点的索引为:$currentIndex,存储的上次索引为:$lastArrivedIndex, ,起点为:(${newPoints[0].longitude},${newPoints[0].latitude}),终点为:(${newPoints.last().longitude},${newPoints.last().latitude})")
|
||||
if (!isLongDistance) {
|
||||
// 过滤缓存的非当次轨迹的索引,并且出现车已走过索引跳跃过大时视为无效复用上一次计算结果
|
||||
if (currentIndex < lastArrivedIndex || (lastArrivedIndex >= 0 && currentIndex - lastArrivedIndex >= 10)) {
|
||||
if (lastArrivedIndex < size) {
|
||||
currentIndex = lastArrivedIndex
|
||||
}
|
||||
} else {
|
||||
lastArrivedIndex = currentIndex
|
||||
}
|
||||
if (size >= 2) {
|
||||
newPoints.add(currentIndex + 1, LatLng(realLat, realLon))
|
||||
return currentIndex + 1
|
||||
}
|
||||
}
|
||||
Log.d(
|
||||
"MarkerDrawerManager", "起点为:(${newPoints[0].longitude},${newPoints[0].latitude}),终点为:(${newPoints.last().longitude},${newPoints.last().latitude})"
|
||||
)
|
||||
if (!isLongDistance && currentIndex > 0) {
|
||||
val size = routePoints.size
|
||||
// // 对于非法结果,需要纠正
|
||||
// if (currentIndex < lastArrivedIndex || (lastArrivedIndex > 0 && currentIndex - lastArrivedIndex > 5)) {
|
||||
// val lastNextIndex = lastArrivedIndex + 1
|
||||
// var isLastNextArrived = false
|
||||
// if (lastNextIndex in 0 until size) {
|
||||
// if (DrivingDirectionUtils.getDegreeOfCar2Poi2(
|
||||
// realLon,
|
||||
// realLat,
|
||||
// routePoints[lastNextIndex].longitude,
|
||||
// routePoints[lastNextIndex].latitude,
|
||||
// heading
|
||||
// ) >= 90
|
||||
// ) {
|
||||
// isLastNextArrived = true
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (isLastNextArrived) {
|
||||
// currentIndex = lastNextIndex
|
||||
// lastArrivedIndex = currentIndex
|
||||
// } else {
|
||||
// if (lastArrivedIndex in 0 until size) {
|
||||
// currentIndex = lastArrivedIndex
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// lastArrivedIndex = currentIndex
|
||||
// }
|
||||
if (size >= 2) {
|
||||
Log.d("MarkerDrawerManager", "最终绘制的已走过index为:$currentIndex,车所在位置为:${currentIndex + 1}")
|
||||
newPoints.add(currentIndex + 1, LatLng(realLat, realLon))
|
||||
return currentIndex + 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
||||
@@ -88,6 +88,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
private var mContext: Context? = null
|
||||
private var mTilt = 0f
|
||||
private var overLayerView: TextView? = null
|
||||
|
||||
@Volatile
|
||||
private var isMapLoaded = false
|
||||
|
||||
@@ -112,10 +113,18 @@ class OverMapView @JvmOverloads constructor(
|
||||
var arrivedBitmap: BitmapDescriptor? = null
|
||||
var unArrivedBitmap: BitmapDescriptor? = null
|
||||
var transparentBitmap: BitmapDescriptor? = null
|
||||
private val pointBitmap by lazy {
|
||||
BitmapDescriptorFactory.fromResource(R.drawable.loc_azure_bg)
|
||||
}
|
||||
private val markerOptionsList by lazy {
|
||||
ArrayList<MarkerOptions>()
|
||||
}
|
||||
private var isDebug = true
|
||||
|
||||
// 绘制轨迹线的集合
|
||||
private val textureList: MutableList<BitmapDescriptor?> = ArrayList()
|
||||
private val texIndexList: MutableList<Int> = ArrayList()
|
||||
|
||||
@Volatile
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var isFirstLocation = true
|
||||
@@ -123,6 +132,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
var currMarkerList: ArrayList<Marker>? = null
|
||||
var siteMarkerList: ArrayList<Marker>? = null
|
||||
var siteNameList: ArrayList<Marker>? = null
|
||||
private var pointMarkers: ArrayList<Marker>? = null
|
||||
|
||||
@Volatile
|
||||
private var isFirst = true
|
||||
@@ -148,6 +158,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
private const val DRAW_POLY_LINE = 1
|
||||
private const val DRAW_CAR_LOCATION = 2
|
||||
private const val CLEAR_POLY_LINE = 3
|
||||
private const val CLEAR_POINT_MARKERS = 4
|
||||
|
||||
private const val DRAW_V2X_MARKERS = 1
|
||||
private const val DISPLAY_OVER_VIEW = 2
|
||||
@@ -235,6 +246,16 @@ class OverMapView @JvmOverloads constructor(
|
||||
overLayerView?.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun setDebugMode(isDebug: Boolean) {
|
||||
this.isDebug = isDebug
|
||||
if (!isDebug) {
|
||||
Message.obtain().apply {
|
||||
what = CLEAR_POINT_MARKERS
|
||||
frequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* siteLatLngs: 高德坐标集合
|
||||
* bitmap: Marker对应的图片
|
||||
@@ -362,6 +383,10 @@ class OverMapView @JvmOverloads constructor(
|
||||
what = CLEAR_POLY_LINE
|
||||
frequentHandler?.sendMessage(this)
|
||||
}
|
||||
Message.obtain().apply {
|
||||
what = CLEAR_POINT_MARKERS
|
||||
frequentHandler?.sendMessage(this)
|
||||
}
|
||||
mStartMarker?.isVisible = false
|
||||
mEndMarker?.isVisible = false
|
||||
|
||||
@@ -778,6 +803,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
* @param locIndex
|
||||
*/
|
||||
private fun realDrawPolyline(coordinates: List<LatLng>, locIndex: Int) {
|
||||
val drawPointMarkers = isDebug && pointMarkers.isNullOrEmpty()
|
||||
val time = System.currentTimeMillis()
|
||||
if (textureList.size > 0) {
|
||||
textureList.clear()
|
||||
@@ -785,6 +811,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
if (texIndexList.size > 0) {
|
||||
texIndexList.clear()
|
||||
}
|
||||
if (drawPointMarkers) markerOptionsList.clear()
|
||||
if (isClearArrived) {
|
||||
textureList.add(transparentBitmap)// index:0
|
||||
} else {
|
||||
@@ -793,7 +820,15 @@ class OverMapView @JvmOverloads constructor(
|
||||
}
|
||||
// 未走过的纹理
|
||||
textureList.add(unArrivedBitmap)// index:1
|
||||
|
||||
for (i in coordinates.indices) {
|
||||
if (drawPointMarkers) {
|
||||
markerOptionsList.add(MarkerOptions().also {
|
||||
it.icon(pointBitmap)
|
||||
it.anchor(0.5f, 0.5f)
|
||||
it.position(coordinates[i])
|
||||
})
|
||||
}
|
||||
// 线段数比点数少一个
|
||||
if (i == 0) continue
|
||||
if (i <= locIndex) {
|
||||
@@ -802,6 +837,9 @@ class OverMapView @JvmOverloads constructor(
|
||||
texIndexList.add(1)
|
||||
}
|
||||
}
|
||||
if (drawPointMarkers) {
|
||||
pointMarkers = mAMap?.addMarkers(markerOptionsList, false)
|
||||
}
|
||||
if (mCoveredPolyline != null) {
|
||||
mCoveredPolyline!!.options.customTextureList = textureList
|
||||
mCoveredPolyline!!.options.customTextureIndex = texIndexList
|
||||
@@ -863,7 +901,8 @@ class OverMapView @JvmOverloads constructor(
|
||||
//设置希望展示的地图缩放级别
|
||||
Log.d(TAG, "切换视角展示车,定位为:${mLocation!!.longitude},${mLocation!!.latitude}")
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(LatLng(mLocation!!.latitude, mLocation!!.longitude)).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
|
||||
.target(LatLng(mLocation!!.latitude, mLocation!!.longitude)).tilt(mTilt)
|
||||
.zoom(zoomLevel.toFloat()).build()
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
}
|
||||
@@ -1006,6 +1045,13 @@ class OverMapView @JvmOverloads constructor(
|
||||
mCoveredPolyline?.points = emptyList()
|
||||
}
|
||||
|
||||
private fun realClearPointMarkers() {
|
||||
pointMarkers?.forEach {
|
||||
it.destroy()
|
||||
}
|
||||
pointMarkers = null
|
||||
}
|
||||
|
||||
private fun realClearSitePolyline() {
|
||||
mSitePolyline?.points = emptyList()
|
||||
}
|
||||
@@ -1165,16 +1211,23 @@ class OverMapView @JvmOverloads constructor(
|
||||
realDrawPolyline(first, second)
|
||||
}
|
||||
}
|
||||
|
||||
DRAW_CAR_LOCATION -> {
|
||||
removeMessages(DRAW_CAR_LOCATION)
|
||||
(msg.obj as MogoLocation).apply {
|
||||
realDrawCarMarker(this)
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_POLY_LINE -> {
|
||||
removeMessages(CLEAR_POLY_LINE)
|
||||
realClearPolyline()
|
||||
}
|
||||
|
||||
CLEAR_POINT_MARKERS -> {
|
||||
removeMessages(CLEAR_POINT_MARKERS)
|
||||
realClearPointMarkers()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1192,57 +1245,68 @@ class OverMapView @JvmOverloads constructor(
|
||||
realDrawSitePolyline(first, second)
|
||||
}
|
||||
}
|
||||
|
||||
DRAW_V2X_MARKERS -> {
|
||||
removeMessages(DRAW_V2X_MARKERS)
|
||||
(msg.obj as ArrayList<MarkerOptions>).apply {
|
||||
realDrawV2XMarkers(this)
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_OVER_VIEW -> {
|
||||
removeMessages(DISPLAY_OVER_VIEW)
|
||||
realDisplayOverView()
|
||||
}
|
||||
|
||||
INCLUDE_SITES_OVER_VIEW -> {
|
||||
removeMessages(INCLUDE_SITES_OVER_VIEW)
|
||||
(msg.obj as List<LatLng>).also {
|
||||
realIncludeSitePointsAndRefresh(it)
|
||||
}
|
||||
}
|
||||
|
||||
DRAW_START_AND_END -> {
|
||||
removeMessages(DRAW_START_AND_END)
|
||||
(msg.obj as List<LatLng>).also {
|
||||
realDrawStartAndEndMarker(it)
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_SITE_POLYLINE -> {
|
||||
removeMessages(CLEAR_SITE_POLYLINE)
|
||||
MarkerDrawerManager.isStopCalculate = false
|
||||
realClearSitePolyline()
|
||||
}
|
||||
|
||||
CLEAR_V2X_MARKERS -> {
|
||||
removeMessages(CLEAR_V2X_MARKERS)
|
||||
realClearV2XMarkers()
|
||||
}
|
||||
|
||||
DRAW_SITE_NAME -> {
|
||||
removeMessages(DRAW_SITE_NAME)
|
||||
(msg.obj as ArrayList<MarkerOptions>).also {
|
||||
realDrawSiteNames(it)
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_SITE_NAME -> {
|
||||
removeMessages(CLEAR_SITE_NAME)
|
||||
realClearSiteNameViews()
|
||||
}
|
||||
|
||||
DRAW_SITE_MARKER -> {
|
||||
(msg.obj as ArrayList<MarkerOptions>).also {
|
||||
realDrawSiteMarkers(it)
|
||||
}
|
||||
removeMessages(DRAW_SITE_MARKER)
|
||||
}
|
||||
|
||||
CLEAR_SITE_MARKER -> {
|
||||
removeMessages(CLEAR_SITE_MARKER)
|
||||
realClearSiteMarkers()
|
||||
}
|
||||
|
||||
DRAW_INF_STRUCTURE -> {
|
||||
removeMessages(DRAW_INF_STRUCTURE)
|
||||
(msg.obj as ArrayList<MarkerOptions>).also {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -64,6 +64,7 @@ fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo {
|
||||
val line = MessagePad.Line.newBuilder()
|
||||
this.autoPilotLine?.let {
|
||||
line.lineId = it.lineId
|
||||
line.lineName = it.lineName
|
||||
line.trajMd5 = it.trajMd5
|
||||
line.trajUrl = it.trajUrl
|
||||
line.stopMd5 = it.stopMd5
|
||||
@@ -85,6 +86,7 @@ fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo {
|
||||
fun AutopilotControlParameters.AutoPilotLine.toAutoPilotLine(): MessagePad.Line {
|
||||
val line = MessagePad.Line.newBuilder()
|
||||
line.lineId = this.lineId
|
||||
line.lineName = this.lineName
|
||||
line.trajMd5 = this.trajMd5
|
||||
line.trajUrl = this.trajUrl
|
||||
line.stopMd5 = this.stopMd5
|
||||
@@ -139,6 +141,7 @@ class AutopilotControlParameters {
|
||||
|
||||
class AutoPilotLine {
|
||||
var lineId = 0L
|
||||
var lineName = ""
|
||||
var trajUrl = ""
|
||||
var trajMd5 = ""
|
||||
var stopUrl = ""
|
||||
@@ -164,7 +167,9 @@ class AutopilotControlParameters {
|
||||
this.vehicleModel = vehicleModel
|
||||
}
|
||||
|
||||
constructor(lineId: Long, trajUrl: String, trajMd5: String, stopUrl: String, stopMd5: String, timestamp: Long, vehicleModel: String, trajUrl_dpqp: String, trajMd5_dpqp: String, stopUrl_dpqp: String, stopMd5_dpqp: String, timestamp_dpqp: Long) {
|
||||
constructor(lineId: Long, trajUrl: String, trajMd5: String, stopUrl: String, stopMd5: String,
|
||||
timestamp: Long, vehicleModel: String, trajUrl_dpqp: String, trajMd5_dpqp: String,
|
||||
stopUrl_dpqp: String, stopMd5_dpqp: String, timestamp_dpqp: Long) {
|
||||
this.lineId = lineId
|
||||
this.trajUrl = trajUrl
|
||||
this.trajMd5 = trajMd5
|
||||
@@ -179,8 +184,29 @@ class AutopilotControlParameters {
|
||||
this.timestamp_dpqp = timestamp_dpqp
|
||||
}
|
||||
|
||||
constructor(lineId: Long, lineName: String, trajUrl: String,
|
||||
trajMd5: String, stopUrl: String, stopMd5: String, timestamp: Long, vehicleModel: String,
|
||||
trajUrl_dpqp: String, trajMd5_dpqp: String, stopUrl_dpqp: String, stopMd5_dpqp: String, timestamp_dpqp: Long) {
|
||||
this.lineId = lineId
|
||||
this.lineName = lineName
|
||||
this.trajUrl = trajUrl
|
||||
this.trajMd5 = trajMd5
|
||||
this.stopUrl = stopUrl
|
||||
this.stopMd5 = stopMd5
|
||||
this.timestamp = timestamp
|
||||
this.vehicleModel = vehicleModel
|
||||
this.trajUrl_dpqp = trajUrl_dpqp
|
||||
this.trajMd5_dpqp = trajMd5_dpqp
|
||||
this.stopUrl_dpqp = stopUrl_dpqp
|
||||
this.stopMd5_dpqp = stopMd5_dpqp
|
||||
this.timestamp_dpqp = timestamp_dpqp
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "AutoPilotLine(lineId=$lineId, trajUrl='$trajUrl', trajMd5='$trajMd5', stopUrl='$stopUrl', stopMd5='$stopMd5', timestamp=$timestamp, vehicleModel='$vehicleModel', trajUrl_dpqp='$trajUrl_dpqp', trajMd5_dpqp='$trajMd5_dpqp', stopUrl_dpqp='$stopUrl_dpqp', stopMd5_dpqp='$stopMd5_dpqp', timestamp_dpqp=$timestamp_dpqp)"
|
||||
return "AutoPilotLine(lineId=$lineId, lineName=$lineName, trajUrl='$trajUrl', trajMd5='$trajMd5', " +
|
||||
"stopUrl='$stopUrl', stopMd5='$stopMd5', timestamp=$timestamp, vehicleModel='$vehicleModel', " +
|
||||
"trajUrl_dpqp='$trajUrl_dpqp', trajMd5_dpqp='$trajMd5_dpqp', stopUrl_dpqp='$stopUrl_dpqp', stopMd5_dpqp='$stopMd5_dpqp', " +
|
||||
"timestamp_dpqp=$timestamp_dpqp)"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
|
||||
private var unableAutopilotReasons: ArrayList<UnableAutopilotReason>? = null
|
||||
|
||||
init {
|
||||
isConnected = isConnected()
|
||||
// isConnected = isConnected() //TODO 重复初始
|
||||
isAutopilotAbility = false
|
||||
unableAutopilotReasons = disconnectedReason()
|
||||
printLog("初始化")
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
<dimen name="dp_139">139dp</dimen>
|
||||
<dimen name="dp_140">140dp</dimen>
|
||||
<dimen name="dp_141">141dp</dimen>
|
||||
<dimen name="dp_141_5">141.5dp</dimen>
|
||||
<dimen name="dp_142">142dp</dimen>
|
||||
<dimen name="dp_143">143dp</dimen>
|
||||
<dimen name="dp_144">144dp</dimen>
|
||||
|
||||
@@ -153,4 +153,43 @@ public class DrivingDirectionUtils {
|
||||
return 180 - Math.abs(Math.abs(angle1 - angle2) - 180);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dx1
|
||||
* @param dy1
|
||||
* @param dx2
|
||||
* @param dy2
|
||||
* @return 两点组成的线段与正北的夹角
|
||||
*/
|
||||
public static double getLineAngle(double dx1, double dy1, double dx2, double dy2) {
|
||||
return getAngleToNorth((dx2 - dx1), (dy2 - dy1));
|
||||
}
|
||||
|
||||
public static double getAngleToNorth(double x, double y) {
|
||||
double resAngle = 0;
|
||||
|
||||
if (0 == x && 0 == y) {
|
||||
resAngle = -400;
|
||||
} else if (0 == y) {
|
||||
if (0 < x) {
|
||||
resAngle = 90;
|
||||
} else {
|
||||
resAngle = 270;
|
||||
}
|
||||
} else if (0 == x) {
|
||||
if (0 < y) {
|
||||
resAngle = 0;
|
||||
} else {
|
||||
resAngle = 180;
|
||||
}
|
||||
} else if (0 < y) {
|
||||
resAngle = (Math.atan((x / y)) * 180 / PI);
|
||||
if (0 > resAngle) {
|
||||
resAngle += 360;
|
||||
}
|
||||
} else {
|
||||
resAngle = (180 + Math.atan((x / y)) * 180 / PI);
|
||||
}
|
||||
return resAngle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ public class LocationUtils {
|
||||
}
|
||||
double p = (a + b + c) / 2;// 半周长
|
||||
double s = Math.sqrt(p * (p - a) * (p - b) * (p - c));// 海伦公式求面积
|
||||
// 如果三个点在一条直线上则求出来的面积为NaN
|
||||
if (Double.isNaN(s)) return 0.0;
|
||||
space = 2 * s / a;// 返回点到线的距离(利用三角形面积公式求高)
|
||||
return space;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ class UtilsBridge {
|
||||
}
|
||||
|
||||
static void runOnUiThread(final Runnable runnable) {
|
||||
ThreadUtils.runOnUiThread(runnable);
|
||||
ThreadUtils.runOnUiThread(runnable, ThreadUtils.MODE.QUEUE);
|
||||
}
|
||||
|
||||
static void runOnUiThreadDelayed(final Runnable runnable, long delayMillis) {
|
||||
|
||||
Reference in New Issue
Block a user