70 lines
2.5 KiB
Kotlin
70 lines
2.5 KiB
Kotlin
package com.arpa.hndahesudintocctmsdriver.util
|
|
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import com.arpa.hndahesudintocctmsdriver.cuspop.MessagePop
|
|
import com.arpa.hndahesudintocctmsdriver.cuspop.SimCenterPop
|
|
import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity
|
|
import com.lxj.xpopup.XPopup
|
|
|
|
/**
|
|
* @ClassName MessageUtils
|
|
* @Author 用户
|
|
* @Date 2023/8/15 09:51
|
|
* @Description TODO
|
|
*/
|
|
class MessageUtils {
|
|
|
|
companion object {
|
|
fun getInstance() = InstanceHelper.sSingle
|
|
}
|
|
|
|
object InstanceHelper {
|
|
val sSingle = MessageUtils()
|
|
}
|
|
|
|
fun showCenMessage(ctx: Context, message: String) {
|
|
XPopup.Builder(ctx) //
|
|
.hasNavigationBar(false)
|
|
.isDestroyOnDismiss(true) //对于只使用一次的弹窗对象,推荐设置这个
|
|
.asCustom(MessagePop(ctx, message).setOnMyItemClickListener(object : MessagePop.OnMyItemClickListener{
|
|
override fun onItemClick(startTime: String, endTime: String) {
|
|
}
|
|
}))
|
|
.show()
|
|
}
|
|
|
|
fun showCenMessage(ctx: Context, message: String, message2: String) {
|
|
XPopup.Builder(ctx) //
|
|
.hasNavigationBar(false)
|
|
.isDestroyOnDismiss(true) //对于只使用一次的弹窗对象,推荐设置这个
|
|
.asCustom(MessagePop(ctx, message,message2).setOnMyItemClickListener(object : MessagePop.OnMyItemClickListener{
|
|
override fun onItemClick(startTime: String, endTime: String) {
|
|
}
|
|
}))
|
|
.show()
|
|
}
|
|
|
|
fun showSimCenPop(ctx: Context, message: String,onMyItemClickListener: SimCenterPop.OnMyItemClickListener){
|
|
|
|
// XPopup.Builder(ctx) //
|
|
// .hasNavigationBar(false)
|
|
// .isDestroyOnDismiss(true) //对于只使用一次的弹窗对象,推荐设置这个
|
|
// .asCustom(SimCenterPop(ctx,message).setOnMyItemClickListener(object : SimCenterPop.OnMyItemClickListener{
|
|
// override fun onItemClick() {
|
|
// val intent = Intent(ctx, CertificatesActivity::class.java)
|
|
// intent.putExtra("index", type)
|
|
// ctx.startActivity(intent)
|
|
// }
|
|
// }))
|
|
// .show()
|
|
|
|
XPopup.Builder(ctx) //
|
|
.hasNavigationBar(false)
|
|
.isDestroyOnDismiss(true) //对于只使用一次的弹窗对象,推荐设置这个
|
|
.asCustom(SimCenterPop(ctx,message).setOnMyItemClickListener(onMyItemClickListener))
|
|
.show()
|
|
|
|
}
|
|
|
|
} |