76 lines
2.1 KiB
Kotlin
76 lines
2.1 KiB
Kotlin
package com.arpa.hndahesudintocctmsdriver.cuspop
|
|
|
|
import android.app.Activity
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import android.net.Uri
|
|
import android.view.View
|
|
import com.arpa.hndahesudintocctmsdriver.R
|
|
import com.dahe.mylibrary.utils.BaseUtils
|
|
import com.dahe.mylibrary.utils.ToastUtils
|
|
import com.lxj.xpopup.core.CenterPopupView
|
|
import kotlinx.android.synthetic.main.load.view.*
|
|
import kotlinx.android.synthetic.main.pop_message_center.view.*
|
|
|
|
|
|
/**
|
|
* @ClassName MessagePop
|
|
* @Author 用户
|
|
* @Date 2023/8/14 18:01
|
|
* @Description TODO
|
|
*/
|
|
class MessagePop(context: Context) : CenterPopupView(context), View.OnClickListener {
|
|
|
|
lateinit var content :String
|
|
var secMessage :String? = ""
|
|
|
|
constructor(context: Context,message : String) :this(context) {
|
|
content = message
|
|
}
|
|
|
|
constructor(context: Context,message : String,message2 : String) :this(context) {
|
|
content = message
|
|
secMessage = message2
|
|
}
|
|
|
|
override fun getImplLayoutId() = R.layout.pop_message_center
|
|
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
tvCancel.setOnClickListener(this)
|
|
tvOk.setOnClickListener(this)
|
|
tvPhone.setOnClickListener(this)
|
|
tvContent.text = "$content"
|
|
tvMessage2.text =secMessage
|
|
}
|
|
|
|
override fun onClick(v: View?) {
|
|
when(v?.id){
|
|
R.id.tvCancel -> {
|
|
dismiss()
|
|
}
|
|
R.id.tvOk,R.id.tvPhone -> {
|
|
dismiss()
|
|
val toString = tvPhone.text.toString()
|
|
val intent = Intent(Intent.ACTION_CALL)
|
|
val data = Uri.parse("tel:$toString")
|
|
intent.data = data
|
|
context.startActivity(intent)
|
|
dismiss()
|
|
// BaseUtils.callPhone(content as Activity, tvPhone.text.toString())
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private var listener: OnMyItemClickListener? = null
|
|
fun setOnMyItemClickListener(listener: OnMyItemClickListener?): MessagePop {
|
|
this.listener = listener
|
|
return this
|
|
}
|
|
|
|
interface OnMyItemClickListener {
|
|
fun onItemClick(startTime: String, endTime: String)
|
|
}
|
|
|
|
} |