Merge remote-tracking branch 'origin/dev_minibus-d_230425_3.2.0' into dev_minibus-d_230425_3.2.0

This commit is contained in:
wangmingjun
2023-04-28 19:31:15 +08:00
21 changed files with 379 additions and 255 deletions

View File

@@ -1,7 +1,5 @@
package com.mogo.och.bus.passenger.callback
interface IDistanceTimeCallback {
interface IDistanceCallback {
fun setDistancecAndTime(meters:Long , timeInSecond:Long )
fun setOrderTimeCallBack(timeInSecond:Long)
}

View File

@@ -0,0 +1,5 @@
package com.mogo.och.bus.passenger.callback
interface ITimeCallback {
fun setOrderTimeCallBack(timeInSecond: Long)
}

View File

@@ -26,12 +26,8 @@ import com.mogo.eagle.core.utilcode.util.*
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.LoopInfo
import com.mogo.och.bus.passenger.bean.response.*
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
import com.mogo.och.bus.passenger.callback.IDistanceTimeCallback
import com.mogo.och.bus.passenger.callback.IOrderChangeCallback
import com.mogo.och.bus.passenger.callback.*
import com.mogo.och.bus.passenger.constant.CharterPassengerConst
import com.mogo.och.bus.passenger.constant.CharterPassengerConst.Companion.Charter_AVERAGE_SPEED
import com.mogo.och.bus.passenger.net.BusPassengerModelLoopManager
import com.mogo.och.bus.passenger.net.BusPassengerServiceManager
import com.mogo.och.bus.passenger.utils.VoiceFocusManager
@@ -46,17 +42,15 @@ import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.PinYinUtil
import com.mogo.och.common.module.voice.VoiceManager
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.SystemStatusInfo
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.TreeMap
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.SystemStatusInfo
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
/**
* Created on 2022/3/31
@@ -97,11 +91,12 @@ object CharterPassengerModel {
private var orderStatus: OrderStatusEnum = OrderStatusEnum.NoOrderUnuse
private val orderStatusChangeListeners =
ConcurrentHashMap<String, IOrderStatusChangeListener>()
private val orderStatusChangeListeners = ConcurrentHashMap<String, IOrderStatusChangeListener>()
private val stationDistanceListener = ConcurrentHashMap<String, IDistanceCallback>()
private val orderLeftTimeListeners = ConcurrentHashMap<String, ITimeCallback>()
private var iDistanceTimeCallback: IDistanceTimeCallback? = null
private var leftTime = -1L
/**
* 到站是否播报 key 线路id+业务 value 是否播报
@@ -157,10 +152,6 @@ object CharterPassengerModel {
mControllerStatusCallbackMap[tag] = callback
}
fun setiDistanceTimeCallback(distanceTimeCallback: IDistanceTimeCallback?) {
this.iDistanceTimeCallback = distanceTimeCallback
}
/**
* 启动轮询查询司机登录状态
*/
@@ -272,6 +263,25 @@ object CharterPassengerModel {
}
orderStatusChangeListeners[tag] = orderStatusChangeListener
}
fun setStationDistanceListener(tag:String,orderStatusChangeListener: IDistanceCallback?) {
if (tag.isBlank()) return
if (orderStatusChangeListener == null) {
stationDistanceListener.remove(tag)
return
}
stationDistanceListener[tag] = orderStatusChangeListener
}
fun setOrderLeftTimeListeners(tag:String,orderStatusChangeListener: ITimeCallback?) {
if (tag.isBlank()) return
if (orderStatusChangeListener == null) {
orderLeftTimeListeners.remove(tag)
return
}
orderLeftTimeListeners[tag] = orderStatusChangeListener
orderStatusChangeListener.setOrderTimeCallBack(leftTime)
}
fun setCarTypeChangeListener(carTypeChageListener: IOrderChangeCallback?){
this.carTypeChageListener = carTypeChageListener
}
@@ -279,6 +289,9 @@ object CharterPassengerModel {
fun getCurrentOrderStatus(): OrderStatusEnum {
return this.orderStatus
}
fun getCurrentOrderInfo():OrderInfoResponse.OrderInfo?{
return orderInfo
}
// endregion
// region 登录状态逻辑
@@ -532,14 +545,14 @@ object CharterPassengerModel {
it.dispose()
}
}
val leadTime = endlast / 1000+60
val leadTime = endlast / 1000
subscribeCountDown =
Observable.intervalRange(0L, leadTime, 0, 1, TimeUnit.SECONDS)
Observable.intervalRange(0L, leadTime, 0, 5, TimeUnit.SECONDS)
.map { aLong -> leadTime - aLong }
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe{millisUntilFinished->
if (millisUntilFinished <= 360L) {
if (millisUntilFinished <= 300L) {
orderInfo?.let {
val isPlayed = SharedPrefs.getInstance(mContext)
.getBoolean("${it.orderNo}$min5Speak", false)
@@ -563,10 +576,10 @@ object CharterPassengerModel {
it.dispose()
}
}
iDistanceTimeCallback?.setOrderTimeCallBack(-1)
iDistanceTimeCallback?.setDistancecAndTime(-1,-1)
invokeOrderLeftTimeListeners(-1)
invokeStationDistanceListener(-1,-1)
}else{
iDistanceTimeCallback?.setOrderTimeCallBack(millisUntilFinished)
invokeOrderLeftTimeListeners(millisUntilFinished)
}
CallerLogger.d(M_BUS_P + TAG, "订单倒计时${millisUntilFinished}")
}
@@ -663,12 +676,9 @@ object CharterPassengerModel {
return
}
if(order.arriveStatus==OrderInfoResponse.ARRIVING) {
iDistanceTimeCallback?.setDistancecAndTime(
lastSumLength.toLong(),
lastTime.toLong()
)
invokeStationDistanceListener(lastSumLength.toLong(), lastTime.toLong())
}else{
iDistanceTimeCallback?.setDistancecAndTime(-1, -1)
invokeStationDistanceListener(-1,-1)
}
}
}
@@ -827,7 +837,7 @@ object CharterPassengerModel {
// 结束路距计算
endCalculateDistanceLoop()
// 到站置距离位0
iDistanceTimeCallback?.setDistancecAndTime(-1,-1)
invokeStationDistanceListener(-1,-1)
}
}
@@ -940,4 +950,22 @@ object CharterPassengerModel {
it.lineName!!,it.startSiteName!!,it.siteName!!,false)
}
}
private fun invokeOrderLeftTimeListeners(timeInSecond: Long){
leftTime = timeInSecond
UiThreadHandler.post({
for (value in orderLeftTimeListeners.values) {
value.setOrderTimeCallBack(timeInSecond)
}
}, UiThreadHandler.MODE.QUEUE)
}
private fun invokeStationDistanceListener(meters:Long , timeInSecond:Long){
UiThreadHandler.post({
for (value in stationDistanceListener.values) {
value.setDistancecAndTime(meters,timeInSecond)
}
}, UiThreadHandler.MODE.QUEUE)
}
}

View File

@@ -1,44 +0,0 @@
package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.model.OrderStatusEnum
import com.mogo.och.bus.passenger.ui.M1EarlyEndOrderFragment
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
class BusPassengerFunctionEarlyEndOrderPresenter(view: M1EarlyEndOrderFragment?) :
BusBasePassengerFunctionDevicePresenter<M1EarlyEndOrderFragment?>(view) {
override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
}
override fun onResume(owner: LifecycleOwner) {
super.onResume(owner)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
}
fun endOrder() {
CharterPassengerModel.endOrder(object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
if (null != data && 0 == data.code) {
ToastUtils.showShort("结束成功")
CharterPassengerModel.setEndOrderStatus()
mView?.closeDialogContaion()
}
}
override fun onFail(code: Int, msg: String) {
ToastUtils.showShort("$code:$msg")
}
})
}
}

View File

@@ -13,8 +13,9 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.response.OrderInfoResponse
import com.mogo.och.bus.passenger.callback.IDistanceCallback
import com.mogo.och.bus.passenger.callback.IOrderChangeCallback
import com.mogo.och.bus.passenger.callback.IDistanceTimeCallback
import com.mogo.och.bus.passenger.callback.ITimeCallback
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.model.IOrderStatusChangeListener
import com.mogo.och.bus.passenger.model.OrderStatusEnum
@@ -36,26 +37,25 @@ import kotlin.math.ceil
class BusPassengerPresenter(view: MainFragment?) :
BusBasePassengerFunctionDevicePresenter<MainFragment?>(view),
IDistanceTimeCallback, IOrderChangeCallback, IOrderStatusChangeListener,
IDistanceCallback, IOrderChangeCallback, IOrderStatusChangeListener,
OCHPlanningStopSideStatusManager.OCHPlanningActionsCallback, LightAirconditionDoorCallback {
override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
CharterPassengerModel.init()
// 定位监听
CharterPassengerModel.setiDistanceTimeCallback(this)
CharterPassengerModel.setStationDistanceListener(TAG,this)
CharterPassengerModel.setCarTypeChangeListener(this)
CharterPassengerModel.setStatusChangeListener(TAG,this)
CallerTelematicListenerManager.addListener(TAG, msgReceived)
OCHPlanningStopSideStatusManager.addListener(TAG,this)
setCarChangeListener(R.raw.m1)
//BusPassengerModel.setMoGoAutopilotPlanningListener(this)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
CharterPassengerModel.setiDistanceTimeCallback(null)
CharterPassengerModel.setStationDistanceListener(TAG,null)
CharterPassengerModel.setCarTypeChangeListener(null)
CallerTelematicListenerManager.removeListener(TAG)
OCHPlanningStopSideStatusManager.removeListener(TAG)
@@ -76,11 +76,6 @@ class BusPassengerPresenter(view: MainFragment?) :
mView?.setDistanceAndTime(distance, distanceUnit,leftTime,arriveTime)
}
}
private fun setOrderTime(sumTime:String,arrivedTime:String){
UiThreadHandler.post {
mView?.setOrderTime(sumTime, arrivedTime)
}
}
val msgReceived = object : IReceivedMsgListener {
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
@@ -145,16 +140,6 @@ class BusPassengerPresenter(view: MainFragment?) :
setDistanceAndTime(dis.toString(),disUnit,time.toString(),arriveTime)
}
override fun setOrderTimeCallBack(timeInSecond: Long) {
if(timeInSecond<0){
setOrderTime("--","--")
return
}
val time = ceil(timeInSecond / 60f).toInt()
val arriveTime = DateTimeUtil.getAfterSecondTime(timeInSecond.toInt())
setOrderTime(time.toString(),arriveTime)
}
companion object{
private const val TAG = "BusPassengerPresenter"
}
@@ -209,7 +194,6 @@ class BusPassengerPresenter(view: MainFragment?) :
mView?.showOpenAndCloseDoor()
mView?.cleanEndStation()
setDistancecAndTime(-1, -1)
setOrderTime("--","--")
}
}
}

View File

@@ -1,18 +1,64 @@
package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.callback.ITimeCallback
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.OrderInfoFragment
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.utils.DateTimeUtil
class OrderInfoPresenter(view: OrderInfoFragment?) :
BusBasePassengerFunctionDevicePresenter<OrderInfoFragment?>(view) {
BusBasePassengerFunctionDevicePresenter<OrderInfoFragment?>(view), ITimeCallback {
companion object{
private const val TAG = "BusPassengerFunctionPresenter"
private const val TAG = "OrderInfoPresenter"
}
override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
CharterPassengerModel.setOrderLeftTimeListeners(TAG,this)
getDataInfo()
}
private fun getDataInfo() {
val currentOrderInfo = CharterPassengerModel.getCurrentOrderInfo()
currentOrderInfo?.let {
mView?.setPhone(it.passengerPhone?:"")
try {
mView?.setStartTimeAndEndTime(
DateTimeUtil.formatLongToString(it.startTime!!, DateTimeUtil.HH_mm),
DateTimeUtil.formatLongToString(it.endTime!!, DateTimeUtil.HH_mm))
}catch (e:Exception){
e.printStackTrace()
}
}
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
CharterPassengerModel.setOrderLeftTimeListeners(TAG,null)
}
override fun setOrderTimeCallBack(timeInSecond: Long) {
val leftTime = DateTimeUtil.second2Time(timeInSecond)
mView?.setLeftTime(leftTime)
}
fun endOrder() {
CharterPassengerModel.endOrder(object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
if (null != data && 0 == data.code) {
ToastUtils.showShort("结束成功")
CharterPassengerModel.setEndOrderStatus()
mView?.closeDialogContaion()
}
}
override fun onFail(code: Int, msg: String) {
ToastUtils.showShort("$code:$msg")
}
})
}
}

View File

@@ -1,60 +0,0 @@
package com.mogo.och.bus.passenger.ui
import android.os.Bundle
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionEarlyEndOrderPresenter
import com.mogo.och.bus.passenger.ui.dialogfragment.M1ContainFragment
import kotlinx.android.synthetic.main.m1_order_early_end.*
/**
* @author: yangyakun
* @date: 2023/1/28
*/
class M1EarlyEndOrderFragment :
MvpFragment<M1EarlyEndOrderFragment?, BusPassengerFunctionEarlyEndOrderPresenter?>() {
private var dismiss: M1ContainFragment.ContainDismiss?=null
override fun getLayoutId(): Int {
return R.layout.m1_order_early_end
}
override fun getTagName(): String {
return TAG
}
override fun initViews() {
tv_early_end_cancle.onClick {
closeDialogContaion()
}
tv_early_end_submit.onClick {
mPresenter?.endOrder()
}
}
fun closeDialogContaion(){
this.dismiss?.closeDialog()
}
override fun createPresenter(): BusPassengerFunctionEarlyEndOrderPresenter {
return BusPassengerFunctionEarlyEndOrderPresenter(this)
}
companion object {
const val TAG = "BusPassengerFunctionOrderFragment"
@JvmStatic
fun newInstance(dismiss: M1ContainFragment.ContainDismiss): M1EarlyEndOrderFragment {
val args = Bundle()
val fragment = M1EarlyEndOrderFragment()
fragment.arguments = args
fragment.setContainDismiss(dismiss)
return fragment
}
}
private fun setContainDismiss(dismiss: M1ContainFragment.ContainDismiss) {
this.dismiss = dismiss
}
}

View File

@@ -16,11 +16,13 @@ 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.AppStateManager
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.common.module.voice.VoiceManager
import com.mogo.och.bus.passenger.presenter.BusPassengerPresenter
import com.mogo.och.bus.passenger.ui.dialogfragment.M1CarUserNoOrderFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.M1ContainFragment
import com.mogo.och.common.module.biz.constant.LoginStatusManager
import kotlinx.android.synthetic.main.m1_main_fragment.*
import java.lang.ref.WeakReference
@@ -65,7 +67,15 @@ class MainFragment :
openSettingPage(M1ContainFragment.SETTINGSOFTTAB)
}
bb_boorombar.setOrderInfoClickListener{
openSettingPage(M1ContainFragment.ORDERINFO)
if (LoginStatusManager.isLogin()) {
if(mPresenter?.haveOrder()==true){
openSettingPage(M1ContainFragment.ORDERINFO)
}else{
ToastUtils.showShort("请确认订单")
}
}else{
ToastUtils.showShort(AbsMogoApplication.getApp().getString(R.string.m1_please_login_driver))
}
}
bb_boorombar.setLineClickListener{
openSettingPage(M1ContainFragment.SELECTLINE)
@@ -130,12 +140,6 @@ class MainFragment :
tv_distance_surplus_time.text = leftTime
tv_distance_arrive_time.text = arriveTime
}
fun setOrderTime(
sumTime: String,
arrivedTime: String
) {
}
fun setCarModle(rawInfo: Int){
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(rawInfo)

View File

@@ -34,10 +34,11 @@ class M1ContainFragment :
var fragmentTag: String = M1VideoFragment.TAG
var fragment: Fragment? = null
var videoFragment:M1VideoFragment? = null
var softFragment:M1SoftFragment? = null
var orderInfoFragment:OrderInfoFragment? = null
var orderLineFragment:M1OrderLineFragment? = null
var closeThis:ContainDismiss = object :ContainDismiss{
override fun closeDialog() {
dismissAllowingStateLoss()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
CallerLogger.d(M_BUS_P+ TAG, "onCreate")
@@ -55,45 +56,29 @@ class M1ContainFragment :
CallerLogger.d(M_BUS_P+ TAG, "setCheckView")
when (tab) {
VIDEOTAB -> {
fragment =videoFragment
?: childFragmentManager.findFragmentByTag(M1VideoFragment.TAG)
fragment =childFragmentManager.findFragmentByTag(M1VideoFragment.TAG)
?: M1VideoFragment.newInstance()
if(videoFragment==null&&fragment is M1VideoFragment){
videoFragment = fragment as M1VideoFragment
}
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.VIDEO)
cl_container.setBackgroundResource(R.drawable.m1_function_bg)
fragmentTag = M1VideoFragment.TAG
}
SETTINGSOFTTAB -> {
fragment =softFragment
?: childFragmentManager.findFragmentByTag(M1SoftFragment.TAG)
fragment =childFragmentManager.findFragmentByTag(M1SoftFragment.TAG)
?: M1SoftFragment.newInstance()
if(softFragment==null&&fragment is M1SoftFragment){
softFragment = fragment as M1SoftFragment
}
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.SETTING)
cl_container.setBackgroundResource(R.drawable.m1_function_bg)
fragmentTag = M1SoftFragment.TAG
}
ORDERINFO -> {
fragment =orderInfoFragment
?: childFragmentManager.findFragmentByTag(OrderInfoFragment.TAG)
?: OrderInfoFragment.newInstance()
if(orderInfoFragment==null&&fragment is OrderInfoFragment){
orderInfoFragment = fragment as OrderInfoFragment
}
fragment =childFragmentManager.findFragmentByTag(OrderInfoFragment.TAG)
?: OrderInfoFragment.newInstance(closeThis)
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.ORDERINFO)
cl_container.background = null
fragmentTag = OrderInfoFragment.TAG
}
SELECTLINE ->{
fragment =orderLineFragment
?: childFragmentManager.findFragmentByTag(M1OrderLineFragment.TAG)
fragment =childFragmentManager.findFragmentByTag(M1OrderLineFragment.TAG)
?: M1OrderLineFragment.newInstance()
if(orderLineFragment==null&&fragment is M1OrderLineFragment){
orderLineFragment = fragment as M1OrderLineFragment
}
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.LINE)
cl_container.background = null
fragmentTag = M1OrderLineFragment.TAG
@@ -104,9 +89,6 @@ class M1ContainFragment :
fragment?.let {
val beginTransaction = childFragmentManager.beginTransaction()
if(!it.isAdded){
beginTransaction.add(it,fragmentTag)
}
beginTransaction
.replace(R.id.fl_function_group, it, fragmentTag)
.commitNow()

View File

@@ -1,9 +1,12 @@
package com.mogo.och.bus.passenger.ui.dialogfragment.fragment
import android.os.Bundle
import android.view.View
import com.mogo.commons.mvp.MvpFragment
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.OrderInfoPresenter
import com.mogo.och.bus.passenger.ui.dialogfragment.M1ContainFragment
import kotlinx.android.synthetic.main.m1_devices_fragment.*
/**
* @author: yangyakun
@@ -12,6 +15,8 @@ import com.mogo.och.bus.passenger.presenter.OrderInfoPresenter
class OrderInfoFragment :
MvpFragment<OrderInfoFragment?, OrderInfoPresenter?>() {
private var dismiss: M1ContainFragment.ContainDismiss?=null
override fun getLayoutId(): Int = R.layout.m1_devices_fragment
override fun getTagName(): String = TAG
@@ -21,7 +26,43 @@ class OrderInfoFragment :
}
private fun initListener() {
actv_end_order_submit.setOnClickListener {
mPresenter?.endOrder()
}
actv_contain_order.setOnClickListener {
this.dismiss?.closeDialog()
}
actv_end_order.setOnClickListener {
cl_order_info.visibility = View.GONE
cl_order_info_endorder_comfit.visibility = View.VISIBLE
}
}
fun setStartTimeAndEndTime(startTime:String,endTime:String){
actv_order_times.text = "$startTime-$endTime"
}
fun setPhone(phone:String){
if(phone.length>8) {
//截取电话号码前三位
val phoneNumPre = phone.substring(0, 3);
//截取电话号码后四位
val phoneNumFix = phone.substring(7);
actv_order_phone.text = "$phoneNumPre****$phoneNumFix"
}else{
actv_order_phone.text = phone
}
}
fun setLeftTime(leftTime:String){
actv_left_time.text = "剩余时间 $leftTime"
}
fun setContainDismiss(dismiss: M1ContainFragment.ContainDismiss) {
this.dismiss = dismiss
}
fun closeDialogContaion(){
this.dismiss?.closeDialog()
}
override fun createPresenter(): OrderInfoPresenter =
@@ -30,10 +71,11 @@ class OrderInfoFragment :
companion object {
const val TAG = "OrderInfoFragment"
@JvmStatic
fun newInstance(): OrderInfoFragment {
fun newInstance(dismiss: M1ContainFragment.ContainDismiss): OrderInfoFragment {
val args = Bundle()
val fragment = OrderInfoFragment()
fragment.arguments = args
fragment.setContainDismiss(dismiss)
return fragment
}
}

View File

@@ -47,12 +47,10 @@ class BottomBar @JvmOverloads constructor(
checkIndex = index
if(checkIndex == SelectView.ORDERINFO){
cl_order_time_press.visibility = VISIBLE
actv_order_end_time.setTextColor(context.getColor(android.R.color.white))
actv_order_end_time_title.setTextColor(context.getColor(android.R.color.white))
cl_order_time.setCheck(true)
}else{
cl_order_time_press.visibility = GONE
actv_order_end_time.setTextColor(context.getColor(R.color.bus_p_m1_0050E1))
actv_order_end_time_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
cl_order_time.setCheck(false)
}
if(checkIndex == SelectView.SETTING){
actv_setting.setCheckItem(true)

View File

@@ -0,0 +1,93 @@
package com.mogo.och.bus.passenger.ui.view.bottom
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.callback.ITimeCallback
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.model.IOrderStatusChangeListener
import com.mogo.och.bus.passenger.model.OrderStatusEnum
import com.mogo.och.common.module.utils.DateTimeUtil
import kotlinx.android.synthetic.main.m1_bottom_orderinfo.view.*
open class BottomOrderInfoView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), ITimeCallback, IOrderStatusChangeListener {
companion object {
private const val TAG = "BottomOrderInfoView"
}
init {
LayoutInflater.from(context).inflate(R.layout.m1_bottom_orderinfo, this, true)
try {
initView(context)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun setCheck(isCheck:Boolean){
if(isCheck){
actv_order_end_time.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_end_time_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
}
}
private fun initView(context: Context) {
setViewByOrderStatus(CharterPassengerModel.getCurrentOrderStatus())
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerLogger.d(SceneConstant.M_BUS_P + TAG,"onAttachedToWindow$this")
CharterPassengerModel.setOrderLeftTimeListeners(this.toString(),this)
CharterPassengerModel.setStatusChangeListener(this.toString(),this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerLogger.d(SceneConstant.M_BUS_P + TAG,"onDetachedFromWindow$this")
CharterPassengerModel.setOrderLeftTimeListeners(this.toString(),null)
CharterPassengerModel.setStatusChangeListener(this.toString(),null)
}
private fun setViewByOrderStatus(currentOrderStatus: OrderStatusEnum) {
when (currentOrderStatus) {
OrderStatusEnum.Nothing,
OrderStatusEnum.NoOrderUse,
OrderStatusEnum.NoOrderUnuse ->{
actv_order_null.visibility = VISIBLE
clg_order_info.visibility = GONE
actv_order_end_time.text = AbsMogoApplication.getApp().getString(R.string.m1_bottom_reach_time)
}
OrderStatusEnum.OrderNoLine,
OrderStatusEnum.OrdersWithLine -> {
actv_order_null.visibility = GONE
clg_order_info.visibility = VISIBLE
}
}
}
override fun setOrderTimeCallBack(timeInSecond: Long) {
if(timeInSecond>0){
val arriveTime = DateTimeUtil.second2Time(timeInSecond)
actv_order_end_time.text = arriveTime
}
setViewByOrderStatus(CharterPassengerModel.getCurrentOrderStatus())
}
override fun onStatusChange(currentStatus: OrderStatusEnum) {
setViewByOrderStatus(currentStatus)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -96,60 +96,15 @@
android:layout_width="@dimen/dp_359"
android:layout_height="@dimen/dp_107"/>
<androidx.constraintlayout.widget.ConstraintLayout
<com.mogo.och.bus.passenger.ui.view.bottom.BottomOrderInfoView
android:id="@+id/cl_order_time"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/actv_setting"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_null"
android:text="订单空空~"
android:textSize="@dimen/dp_36"
android:textColor="@color/bus_p_m1_090f28"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_end_time"
android:text="08:15"
android:textSize="@dimen/dp_60"
android:textColor="@color/bus_p_m1_0050E1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_end_time_title"
android:text="剩余包车时长"
android:textSize="@dimen/dp_20"
android:textColor="@color/bus_p_m1_090f28"
android:layout_marginBottom="@dimen/dp_7_5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/clg_order_info"
android:visibility="gone"
app:constraint_referenced_ids="actv_order_end_time,actv_order_end_time_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_width="@dimen/dp_167"
android:layout_height="match_parent"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/actv_setting_press"

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<merge 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:layout_width="match_parent"
android:layout_height="@dimen/dp_107"
tools:ignore="MissingDefaultResource"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="订单空空~"
android:textColor="@color/bus_p_m1_090f28"
android:textSize="@dimen/dp_36"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/m1_bottom_reach_time"
android:textColor="@color/bus_p_m1_0050E1"
android:textSize="@dimen/dp_60"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_end_time_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_7_5"
android:text="剩余包车时长"
android:textColor="@color/bus_p_m1_090f28"
android:textSize="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/clg_order_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="actv_order_end_time,actv_order_end_time_title" />
</merge>

View File

@@ -6,6 +6,7 @@
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_order_info"
android:background="@drawable/charter_p_shape_order_info"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -19,7 +20,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_33"
android:text="18811539480"
android:text="----"
android:textSize="@dimen/dp_20"
android:textColor="@color/bus_p_m1_203555"
android:layout_marginTop="@dimen/dp_32"
@@ -32,7 +33,7 @@
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_31"
app:layout_constraintTop_toBottomOf="@+id/actv_order_phone"
android:text="09:00-18:00"
android:text="--:-----:--"
android:textSize="@dimen/dp_36"
android:textColor="@color/bus_p_m1_0050E1"
android:layout_width="wrap_content"
@@ -73,6 +74,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_order_info_endorder_comfit"
android:background="@drawable/charter_p_shape_order_info"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -82,8 +84,18 @@
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_270">
<androidx.appcompat.widget.AppCompatImageView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_22"
android:layout_marginStart="@dimen/dp_44"
android:src="@drawable/charter_endorder_head"
android:layout_width="@dimen/dp_66"
android:layout_height="@dimen/dp_68"/>
<androidx.appcompat.widget.AppCompatTextView
android:text="剩余时间 02:37"
android:id="@+id/actv_left_time"
android:text="剩余时间 --:--"
android:textSize="@dimen/dp_20"
android:textColor="@color/bus_p_m1_5F7096"
app:layout_constraintEnd_toEndOf="parent"
@@ -108,6 +120,7 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_end_order_submit"
android:text="结束用车"
android:textSize="@dimen/dp_24"
android:textColor="@android:color/white"
@@ -124,7 +137,8 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:text="结束用车"
android:id="@+id/actv_contain_order"
android:text="继续用车"
android:textSize="@dimen/dp_24"
android:textColor="@android:color/white"
android:background="@drawable/charter_p_shape_end_order"

View File

@@ -99,7 +99,7 @@
android:layout_marginBottom="@dimen/dp_17"
android:background="@drawable/bus_p_function_aircondition_switch_selector"
android:button="@null"
android:checked="true"
android:checked="false"
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
android:text="打开空调"
android:gravity="left|center_vertical"

View File

@@ -34,6 +34,8 @@
<string name="m1_arrive_left_time">剩余(分)</string>
<string name="m1_reach_time">到达</string>
<string name="m1_bottom_reach_time">--:--</string>
<string name="m1_stop_site">靠边停车</string>

View File

@@ -30,6 +30,7 @@ import kotlinx.android.synthetic.driverm1.fragment_driver_m1.*
import me.jessyan.autosize.utils.AutoSizeUtils
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import kotlin.math.ceil
import kotlin.math.roundToInt
/**
@@ -218,7 +219,7 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
clearCountDownTimer()
countDownTimer = object : CountDownTimer(total,countDownInterval){
override fun onTick(millisUntilFinished: Long) {
var minute: Float = (millisUntilFinished/1000/60).toFloat()
val minute: Double = ceil(millisUntilFinished/1000/60.0)
driverm1_order_count_down.text = String.format(
resources.getString(R.string.count_down_txt)

View File

@@ -121,4 +121,28 @@ public class DateTimeUtil {
beforeTime.add(Calendar.SECOND, timeInSecond);
return formatCalendarToString(beforeTime, DateTimeUtil.HH_mm);
}
/**
* @param second 秒
* @description: 秒转换为时分秒 HH:mm:ss 格式 仅当小时数大于0时 展示HH
*/
public static String second2Time(Long second) {
if (second == null || second < 0) {
return "00:00";
}
long h = second / 3600;
long m = (long) Math.ceil((second % 3600) / 60.0);// 向上取整
long s = second % 60;
StringBuilder stringBuffer = new StringBuilder();
if (h > 0) {
stringBuffer.append(h < 10 ? ("0" + h) : h).append(":");
}else {
stringBuffer.append("00:");
}
stringBuffer.append(m < 10 ? ("0" + m) : m);
//str += (s < 10 ? ("0" + s) : s);
return stringBuffer.toString();
}
}

View File

@@ -29,7 +29,7 @@ if (!isAndroidTestBuild()) {
apply plugin: 'chain.log.hook'
hooklog {
enableTraceToServer false
enableLoggerToLocal false
enableLoggerToLocal true
}
apply plugin: 'biz.config.hook'