[6.7.0]
[fea] [结束服务]
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
package com.mogo.och.common.module.wigets.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
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.annotation.ColorRes
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -28,6 +32,7 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
private var commonTips : TextView? = null
|
||||
private var countDownTxt: AppCompatTextView? = null
|
||||
private var commonStatus:AppCompatImageView?=null
|
||||
private var commonClose:AppCompatImageView?=null
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
@@ -35,9 +40,14 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
|
||||
private var mCountdownValue: Int = 0
|
||||
|
||||
private var status:Status = Status.ask
|
||||
private var showCloseView:Boolean = false
|
||||
|
||||
constructor(builder: Builder,context: Context) : super(context) {
|
||||
@ColorRes
|
||||
private var cancelTextColor:Int = R.color.white
|
||||
|
||||
private var status: Status = Status.ask
|
||||
|
||||
constructor(builder: Builder, context: Context) : super(context) {
|
||||
commonTitle?.text = builder.titleStr
|
||||
commonTips?.text = builder.tipsStr
|
||||
commonCancel?.text = builder.cancelStr
|
||||
@@ -45,6 +55,12 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
countDownTxt?.text = builder.countDownValue.toString()
|
||||
mCountdownValue = builder.countDownValue
|
||||
status = builder.statusEnum
|
||||
showCloseView = builder.showClose
|
||||
cancelTextColor = builder.cancelTextColor
|
||||
this.clickListener = builder.clickListener
|
||||
|
||||
commonCancel?.setTextColor(ResourcesUtils.getColors(cancelTextColor))
|
||||
|
||||
when (status) {
|
||||
Status.ask -> {
|
||||
commonStatus?.setImageResource(R.drawable.common_dialog_icon_ask)
|
||||
@@ -52,6 +68,9 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
Status.loading -> {
|
||||
commonStatus?.setImageResource(R.drawable.common_dialog_status_loading)
|
||||
}
|
||||
Status.success -> {
|
||||
commonStatus?.setImageResource(R.drawable.common_feedback_success)
|
||||
}
|
||||
}
|
||||
|
||||
if (mCountdownValue > 0){
|
||||
@@ -59,6 +78,9 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
}else{
|
||||
countDownTxt?.visibility = View.GONE
|
||||
}
|
||||
if(showCloseView){
|
||||
commonClose?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
init{
|
||||
@@ -72,6 +94,7 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
commonTips = findViewById(R.id.common_dialog_content_new)
|
||||
countDownTxt = findViewById(R.id.common_count_down_new)
|
||||
commonStatus = findViewById(R.id.common_dialog_status)
|
||||
commonClose = findViewById(R.id.common_dialog_close)
|
||||
|
||||
commonConfirm?.setOnClickListener{
|
||||
clickListener?.confirm()
|
||||
@@ -81,6 +104,10 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
commonClose?.onClick {
|
||||
clickListener?.dismiss()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
@@ -88,8 +115,9 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
}
|
||||
|
||||
interface ClickListener{
|
||||
fun confirm()
|
||||
fun cancel()
|
||||
fun confirm(){}
|
||||
fun cancel(){}
|
||||
fun dismiss(){}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -151,35 +179,53 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
var confirmStr:String = ""
|
||||
var cancelStr:String = ""
|
||||
var countDownValue: Int = 0
|
||||
var showClose:Boolean =false
|
||||
var cancelTextColor:Int = Color.WHITE
|
||||
var clickListener:ClickListener?=null
|
||||
|
||||
fun title(title: String) : Builder{
|
||||
fun title(title: String) : Builder {
|
||||
this.titleStr = title
|
||||
return this
|
||||
}
|
||||
|
||||
fun tips(tips: String) : Builder{
|
||||
fun tips(tips: String) : Builder {
|
||||
this.tipsStr = tips
|
||||
return this
|
||||
}
|
||||
|
||||
fun confirmStr(commit: String) : Builder{
|
||||
fun confirmStr(commit: String) : Builder {
|
||||
this.confirmStr = commit
|
||||
return this
|
||||
}
|
||||
|
||||
fun showClose(show:Boolean):Builder{
|
||||
this.showClose = show
|
||||
return this
|
||||
}
|
||||
|
||||
fun cancelTextColor(@ColorRes color: Int): Builder {
|
||||
this.cancelTextColor = color
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 不传倒计时没有, >0 有倒计时
|
||||
*/
|
||||
fun countdownValue(value: Int): Builder{
|
||||
fun countdownValue(value: Int): Builder {
|
||||
this.countDownValue = value
|
||||
return this
|
||||
}
|
||||
|
||||
fun cancelStr(cancel: String) : Builder{
|
||||
fun cancelStr(cancel: String) : Builder {
|
||||
this.cancelStr = cancel
|
||||
return this
|
||||
}
|
||||
|
||||
fun clickListener(clickListener: ClickListener): Builder {
|
||||
this.clickListener = clickListener
|
||||
return this
|
||||
}
|
||||
|
||||
fun build(context: Context): CommonDialogStatus {
|
||||
return CommonDialogStatus(this,context)
|
||||
}
|
||||
@@ -191,7 +237,7 @@ class CommonDialogStatus: BaseFloatDialog, LifecycleObserver {
|
||||
}
|
||||
|
||||
enum class Status{
|
||||
ask,loading
|
||||
ask,loading,success
|
||||
}
|
||||
|
||||
}
|
||||
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_dialog_close.png
Executable file
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_dialog_close.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 409 B |
@@ -8,6 +8,16 @@
|
||||
android:background="@drawable/bg_bone_dialog"
|
||||
app:roundLayoutRadius="@dimen/dp_50">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/common_dialog_close"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/common_dialog_close"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/common_dialog_status"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
|
||||
@@ -6,13 +6,12 @@ import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.wigets.CommonDialogStatus
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.common.module.wigets.CommonSlideView
|
||||
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
@@ -26,7 +25,6 @@ import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.actv_runnin
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.bus_task_running_line_name
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.loading_arrive_station
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.rl_running_task_station_list
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
|
||||
class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.mogo.och.unmanned.taxi.ui.routing.RoutingSwitchModel
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.TaxiRoutingFeedbackDialog
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.TaxiRoutingModel
|
||||
import com.mogo.och.common.module.map.MapMakerManager
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.unmanned.taxi.utils.TaskUtils
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_current_itinerary_end_name
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_current_itinerary_start_name
|
||||
@@ -91,16 +92,16 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
|
||||
private fun showFeedbackDialog(grayId: Long) {
|
||||
val occurrenceTime = System.currentTimeMillis()
|
||||
val builder: TaxiRoutingFeedbackDialog.Builder = TaxiRoutingFeedbackDialog.Builder()
|
||||
builder.cancelStr(
|
||||
MainMoGoApplication.getApp()
|
||||
.getString(R.string.routing_feedback_result_btn_not_sure)
|
||||
).confirmStr(
|
||||
MainMoGoApplication.getApp()
|
||||
.getString(R.string.routing_feedback_result_btn_sure)
|
||||
).tips(MainMoGoApplication.getApp().getString(R.string.routing_feedback_result_hint))
|
||||
.clickListener(object :
|
||||
TaxiRoutingFeedbackDialog.TaxiRoutingFeedBackDialogClickListener {
|
||||
CommonDialogStatus
|
||||
.Builder()
|
||||
.title("路线验证结束")
|
||||
.tips("请点击按钮反馈验证结果")
|
||||
.showClose(true)
|
||||
.cancelTextColor(R.color.taxi_color_FF4E41)
|
||||
.cancelStr("线路可用")
|
||||
.confirmStr("线路不可用")
|
||||
.status(CommonDialogStatus.Status.success)
|
||||
.clickListener(object :CommonDialogStatus.ClickListener{
|
||||
override fun confirm() {
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.endGrayTask( grayId,
|
||||
@@ -115,8 +116,36 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
occurrenceTime)
|
||||
}
|
||||
})
|
||||
mFeedbackDialog = builder.build(context)
|
||||
mFeedbackDialog?.showDialog()
|
||||
.build(context).show()
|
||||
|
||||
|
||||
|
||||
// val builder: TaxiRoutingFeedbackDialog.Builder = TaxiRoutingFeedbackDialog.Builder()
|
||||
// builder.cancelStr(
|
||||
// MainMoGoApplication.getApp()
|
||||
// .getString(R.string.routing_feedback_result_btn_not_sure)
|
||||
// ).confirmStr(
|
||||
// MainMoGoApplication.getApp()
|
||||
// .getString(R.string.routing_feedback_result_btn_sure)
|
||||
// ).tips(MainMoGoApplication.getApp().getString(R.string.routing_feedback_result_hint))
|
||||
// .clickListener(object :
|
||||
// TaxiRoutingFeedbackDialog.TaxiRoutingFeedBackDialogClickListener {
|
||||
// override fun confirm() {
|
||||
// swtichViewModel?.showLoading()
|
||||
// viewModel?.endGrayTask( grayId,
|
||||
// EndGrayTaskFeedbackType.USABLE_YES,
|
||||
// occurrenceTime)
|
||||
// }
|
||||
//
|
||||
// override fun cancel() {
|
||||
// swtichViewModel?.showLoading()
|
||||
// viewModel?.endGrayTask( grayId,
|
||||
// EndGrayTaskFeedbackType.USABLE_NO,
|
||||
// occurrenceTime)
|
||||
// }
|
||||
// })
|
||||
// mFeedbackDialog = builder.build(context)
|
||||
// mFeedbackDialog?.showDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user