[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"
|
||||
|
||||
Reference in New Issue
Block a user