[3.2.0] m1 司机端增加进站按钮,倒计时向上取整

This commit is contained in:
wangmingjun
2023-04-18 19:45:21 +08:00
parent 802ba870fb
commit 8e341a0c70
4 changed files with 61 additions and 6 deletions

View File

@@ -22,7 +22,8 @@ data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id ,
var wgs84Lat: Double = 0.0,
var startTime: Long,
var endTime: Long,
var passengerPhone: String
var passengerPhone: String,
val arriveStatus:Int?,//1:未到达 2:到达
){
override fun equals(o: Any?): Boolean {
if (this === o) return true
@@ -38,6 +39,12 @@ data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id ,
&& wgs84Lon == result.wgs84Lon
&& wgs84Lon == result.wgs84Lon
&& Objects.equals(passengerPhone , result.passengerPhone)
&& arriveStatus == result.arriveStatus
}
companion object{
const val ARRIVING = 1 //未到站
const val ARRIVED = 2 //到站
}
}
}

View File

@@ -9,6 +9,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.magic.mogo.och.charter.R
import com.magic.mogo.och.charter.base.CharterBaseFragment
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse.Result.Companion.ARRIVED
import com.magic.mogo.och.charter.constant.CharterConst.Companion.LOOP_PERIOD_60S
import com.magic.mogo.och.charter.net.login.LoginDriverM1Impl
import com.magic.mogo.och.charter.presenter.DriverM1Presenter
@@ -29,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.roundToInt
/**
* @author: wangmingjun
@@ -88,12 +90,17 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
driverm1StationName1Tv.text = orderStatus.startSiteName
driverm1StationName2Tv.text = orderStatus.siteName
}
if (orderStatus.arriveStatus == ARRIVED){
setArrivedClickable(true)
}else{
setArrivedClickable(false)
}
}
}
fun updateCountDown(minutes: Long) {
if (minutes + LOOP_PERIOD_60S >= 0){
startCountDownTimer(minutes + LOOP_PERIOD_60S,LOOP_PERIOD_60S)
if (minutes >= 0){
startCountDownTimer(minutes,LOOP_PERIOD_60S)
}else{
clearCountDownTimer()
}
@@ -201,6 +208,7 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}else{
slidePanelView?.visibility = VISIBLE
}
setArrivedClickable(false)
}
}
@@ -209,16 +217,16 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
clearCountDownTimer()
countDownTimer = object : CountDownTimer(total,countDownInterval){
override fun onTick(millisUntilFinished: Long) {
var minute = millisUntilFinished/1000/60
var minute: Float = (millisUntilFinished/1000/60).toFloat()
driverm1_order_count_down.text = String.format(
resources.getString(R.string.count_down_txt)
,minute.toInt())
,minute.roundToInt())
if(minute.toInt() == 5){//还车提示
mPresenter?.carReturnTip()
}
d(SceneConstant.M_CHARTER_D + TAG, "倒计时分钟 = $minute" )
d(SceneConstant.M_CHARTER_D + TAG, "倒计时分钟 = ${minute.roundToInt()}" )
}
override fun onFinish() {
@@ -234,4 +242,8 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
countDownTimer = null
}
}
override fun onArriveStation() {
mPresenter!!.onAutopilotArriveAtStation(null)
}
}

View File

@@ -32,6 +32,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
import com.mogo.eagle.core.function.smp.view.SmallMapView
import com.mogo.eagle.core.function.view.MapBizView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -39,6 +40,7 @@ import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.och.common.module.utils.SoundPoolHelper
import kotlinx.android.synthetic.main.charter_base_fragment.*
import org.greenrobot.eventbus.EventBus
import java.util.*
@@ -166,6 +168,10 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
)
}
module_mogo_och_arrived_tv.onClick {
onArriveStation()
}
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout)
mSettingBtn!!.setOnClickListener { v: View? ->
// TODO: 2021/12/9
@@ -215,6 +221,8 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
smallMapView!!.onResume()
}
protected abstract fun onArriveStation()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?
, savedInstanceState: Bundle?): View? {
EventBus.getDefault().register(this)
@@ -246,6 +254,20 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
}
}
/**
* 到站按钮状态切换
*/
open fun setArrivedClickable(isClickable: Boolean) {
requireActivity().runOnUiThread {
module_mogo_och_arrived_tv.isEnabled = isClickable
if (isClickable) {
module_mogo_och_arrived_tv.setTextColor(resources.getColor(R.color.bus_white))
} else {
module_mogo_och_arrived_tv.setTextColor(resources.getColor(R.color.bus_arrived_btn_un_clickable_color))
}
}
}
/**
* 隐藏滑动按钮
*/

View File

@@ -217,6 +217,20 @@
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_station_panel_container"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/module_mogo_och_arrived_tv"
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
android:background="@drawable/bus_operation_status_bg"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="@string/bus_arrived_str"
android:textColor="@color/bus_autopilot_text_color_selector"
android:textSize="@dimen/module_mogo_och_arrived_text_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--切换地图远近事件 @dimen/module_switch_map -->
<LinearLayout
android:id="@+id/bus_switch_model_layout"