[3.2.0] 1、倒计时120s 2、类魔方功能加减速 3、三方同步opt

This commit is contained in:
wangmingjun
2023-04-26 18:23:14 +08:00
parent 8d7dfc01e0
commit ab0ea94455
11 changed files with 124 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id ,
var endTime: Long,
var passengerPhone: String,
val arriveStatus:Int?,//1:未到达 2:到达
val writeVersion: Long = 0 //更新时间戳
){
override fun equals(o: Any?): Boolean {
if (this === o) return true
@@ -40,6 +41,7 @@ data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id ,
&& wgs84Lon == result.wgs84Lon
&& Objects.equals(passengerPhone , result.passengerPhone)
&& arriveStatus == result.arriveStatus
&& writeVersion == result.writeVersion
}
companion object{

View File

@@ -185,6 +185,7 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
ochCommitDialog = builder.title(title).tips(content)
.confirmStr(getString(R.string.bus_dialog_confirm))
.cancelStr(getString(R.string.bus_dialog_cancel))
.countdownValue(120)
.build(requireContext())
ochCommitDialog?.setClickListener(object : OCHCommitDialog.ClickListener {
override fun confirm() { //同意

View File

@@ -225,7 +225,14 @@ class DriverM1Model {
ChangeDestMsg::class.java) as ChangeDestMsg
currentChangeDestMsg = changeDestMsg
showChangerDestCommitDialog(changeDestMsg)
}
}else if (msg.type == DPMsgType.TYPE_TASK_DETAILS.type){
// TODO: 本地拿到订单状态变更
val changeDestMsg = GsonUtils.fromJson(String(byteArray),
ChangeDestMsg::class.java) as ChangeDestMsg
// 乘客屏同步的状态信息同步给报站屏, 1、选定目的地成功后同步 2、到站同步 3、包车时间结束同步
sendMsgToClient(changeDestMsg)
}
d(SceneConstant.M_CHARTER_D,"onReceivedMsg = "+ GsonUtils.toJson(msg))
}catch (e: Exception){
d(SceneConstant.M_CHARTER_D,"onReceivedMsg = "+"消息解析错误")

View File

@@ -23,7 +23,9 @@ data class ChangeDestMsg(
var startSiteName: String = "",
var destSiteId: Int= 0, //目的地
var destSiteName: String = "",
var isConfirmed: Boolean = false //司机端是否同意
var isConfirmed: Boolean = false, //司机端是否同意
var arriveStatus:Int?, //1:未到达 2:到达
var writtenVersion:Long?, //版本标记
): BaseDPMsg(DPMsgType.TYPE_CHANGE_DEST.type)
data class DPCommonOperationMsg(

View File

@@ -38,6 +38,11 @@ class DriverMoFangFunctionView @JvmOverloads constructor(
whistleIv.onClick {
DriverMoFangFunctionManager.driverMoFangFunctionManager.sendOperatorSetHornByDriver()
}
whistleIv.setOnLongClickListener {
DriverMoFangFunctionManager.driverMoFangFunctionManager.sendOperatorSetHornByDriver()
true
}
}
}

View File

@@ -1,10 +1,21 @@
package com.mogo.och.common.module.wigets
import android.content.Context
import android.view.View
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.view.animation.LinearInterpolator
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.R
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.dialog_bus_commit.*
import java.util.concurrent.TimeUnit
/**
* 带有title, tip,confirm,cancel的dialog
@@ -15,14 +26,22 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
private var commonCancel : TextView? = null
private var commonTitle : TextView? = null
private var commonTips : TextView? = null
private var countDownTxt: TextView? = null
private var countdownRotateIv: AppCompatImageView? = null
private var clickListener: ClickListener? = null
private var subscribeCountDown: Disposable? = null
private var mCountdownValue: Int = 0
constructor(builder: Builder,context: Context) : super(context) {
commonTitle?.text = builder.titleStr
commonTips?.text = builder.tipsStr
commonCancel?.text = builder.cancelStr
commonConfirm?.text = builder.confirmStr
countDownTxt?.text = builder.countDownValue.toString()
mCountdownValue = builder.countDownValue
}
init{
@@ -34,6 +53,8 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
commonCancel = findViewById(R.id.common_cancel)
commonTitle = findViewById(R.id.common_title)
commonTips = findViewById(R.id.common_tips)
countDownTxt = findViewById(R.id.sec_count_down)
countdownRotateIv = findViewById(R.id.count_down_rotate_iv)
commonConfirm?.setOnClickListener{
clickListener?.confirm()
@@ -43,6 +64,14 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
clickListener?.cancel()
dismiss()
}
if (mCountdownValue > 0){
countDownTxt?.visibility = View.VISIBLE
countdownRotateIv?.visibility = View.VISIBLE
}else{
countDownTxt?.visibility = View.GONE
countdownRotateIv?.visibility = View.GONE
}
}
fun setClickListener(clickListener: ClickListener) {
@@ -54,11 +83,53 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
fun cancel()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (mCountdownValue > 0){
startCountDown()
}
}
private fun startCountDown() {
subscribeCountDown?.let {
if (!it.isDisposed) {
it.dispose()
}
}
subscribeCountDown = Observable.intervalRange(0L
, mCountdownValue.toLong(), 0, 1, TimeUnit.SECONDS)
.map { aLong -> mCountdownValue - aLong }
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe {
UiThreadHandler.post {
mCountdownValue -= 1
countDownTxt?.text = mCountdownValue.toString()
}
}
val mAnimation: Animation = AnimationUtils.loadAnimation(context, R.anim.count_down_rotate)
val lin = LinearInterpolator()
mAnimation.interpolator = lin
count_down_rotate_iv.startAnimation(mAnimation)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
subscribeCountDown?.let {
if (!it.isDisposed) {
it.dispose()
}
}
}
class Builder{
var titleStr:String = ""
var tipsStr:String = ""
var confirmStr:String = ""
var cancelStr:String = ""
var countDownValue: Int = 0
fun title(title: String) : Builder{
this.titleStr = title
@@ -75,6 +146,14 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
return this
}
/**
* 不传倒计时没有, >0 有倒计时
*/
fun countdownValue(value: Int): Builder{
this.countDownValue = value
return this
}
fun cancelStr(cancel: String) : Builder{
this.cancelStr = cancel
return this

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate android:fromDegrees="0"
android:toDegrees="359"
android:duration="500"
android:repeatCount="-1"
android:pivotX="50%"
android:pivotY="50%"/>
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -7,6 +7,21 @@
android:background="@color/och_dialog_bg_color"
app:roundLayoutRadius="32dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/count_down_rotate_iv"
android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_65"
android:src="@drawable/count_down_rotate_bg"/>
<TextView
android:id="@+id/sec_count_down"
android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_65"
android:gravity="center"
android:textSize="@dimen/dp_20"
android:text="120"
android:background="@drawable/count_down_bg"/>
<TextView
android:id="@+id/common_title"
android:layout_width="wrap_content"
@@ -63,7 +78,7 @@
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constrintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/view_vertical_line"
/>

View File

@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/dp_40"
android:background="@android:color/transparent">
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout