[3.2.0] 包车司机端确认倒计时

This commit is contained in:
wangmingjun
2023-05-05 19:37:35 +08:00
parent 8c3f02b9c1
commit 357b5fc877
3 changed files with 41 additions and 19 deletions

View File

@@ -651,6 +651,7 @@ class DriverM1Model {
if (TextUtils.isEmpty(data.data.orderNo)){//还未换车,显示还车状态
mOrderCallback?.updateReturnCarStatus(false)
mCurrentOrder = null
currentChangeDestMsg = null
sendCharterEndTripInfo()
startOrStopCheckCountDown(false)
updateToClientData()
@@ -662,6 +663,7 @@ class DriverM1Model {
mOrderCallback?.updateReturnCarStatus(true)
clearAutopilotControlParameters()
mCurrentOrder = null
currentChangeDestMsg = null
startOrStopCheckCountDown(false)
updateToClientData()
}

View File

@@ -42,6 +42,14 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
commonConfirm?.text = builder.confirmStr
countDownTxt?.text = builder.countDownValue.toString()
mCountdownValue = builder.countDownValue
if (mCountdownValue > 0){
countDownTxt?.visibility = View.VISIBLE
countdownRotateIv?.visibility = View.VISIBLE
}else{
countDownTxt?.visibility = View.GONE
countdownRotateIv?.visibility = View.GONE
}
}
init{
@@ -64,14 +72,6 @@ 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) {
@@ -96,6 +96,11 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
it.dispose()
}
}
val mAnimation: Animation = AnimationUtils.loadAnimation(context, R.anim.count_down_rotate)
val lin = LinearInterpolator()
mAnimation.interpolator = lin
countdownRotateIv?.startAnimation(mAnimation)
subscribeCountDown = Observable.intervalRange(0L
, mCountdownValue.toLong(), 0, 1, TimeUnit.SECONDS)
.map { aLong -> mCountdownValue - aLong }
@@ -105,14 +110,20 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
UiThreadHandler.post {
mCountdownValue -= 1
countDownTxt?.text = mCountdownValue.toString()
if (mCountdownValue == 0){
mAnimation.cancel()
countdownRotateIv?.clearAnimation()
countDownTxt?.visibility = View.GONE
countdownRotateIv?.visibility = View.GONE
dialogCancel()
}
}
}
}
val mAnimation: Animation = AnimationUtils.loadAnimation(context, R.anim.count_down_rotate)
val lin = LinearInterpolator()
mAnimation.interpolator = lin
count_down_rotate_iv.startAnimation(mAnimation)
private fun dialogCancel() {
clickListener?.cancel()
dismiss()
}
override fun onDetachedFromWindow() {

View File

@@ -2,6 +2,7 @@
<com.mogo.och.common.module.wigets.OCHRoundConstraintLayout
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="840dp"
android:layout_height="470dp"
android:background="@color/och_dialog_bg_color"
@@ -9,18 +10,26 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/count_down_rotate_iv"
android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_65"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
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:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:background="@drawable/count_down_bg"
android:gravity="center"
android:textSize="@dimen/dp_20"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
android:text="120"
android:background="@drawable/count_down_bg"/>
android:textSize="@dimen/dp_20"/>
<TextView
android:id="@+id/common_title"