From d59d55575d913646b7a90fca651904ab889c6723 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 18 二月 2022 16:30:53 +0800
Subject: [PATCH] ### 一、任务模块相关
---
app/src/main/java/cn/flightfeather/thirdappmodule/util/DialogUtil2.kt | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/util/DialogUtil2.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/util/DialogUtil2.kt
index f1bad8e..0a6dff3 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/util/DialogUtil2.kt
+++ b/app/src/main/java/cn/flightfeather/thirdappmodule/util/DialogUtil2.kt
@@ -71,6 +71,41 @@
}
}
+ fun showAlertDialog2(
+ context: Context?,
+ content: String,
+ pStr: String? = null,
+ nStr: String? = null,
+ onConfirmed: (dialog: Dialog) -> Unit = { it.dismiss() },
+ onCanceled: (dialog: Dialog) -> Unit = { it.dismiss() }
+ ): Dialog? {
+ val view = LayoutInflater.from(context).inflate(R.layout.dialog_alert_2, null)
+ return context?.let {
+ Dialog(it).apply {
+ setCancelable(false)
+ setCanceledOnTouchOutside(false)
+ setContentView(view)
+ view.findViewById<TextView>(R.id.tv_dialog_content).text = content
+ view.findViewById<TextView>(R.id.tv_positive).let {t ->
+ pStr?.let { p -> t.text = p }
+ t.setOnClickListener { onConfirmed(this) }
+ }
+ view.findViewById<TextView>(R.id.tv_neutral).let {t ->
+ nStr?.let { n -> t.text = n }
+ t.setOnClickListener { onCanceled(this) }
+ }
+ window?.attributes?.apply {
+ gravity = Gravity.CENTER
+ width = (ScreenUtils.getScreenWidth(context) * 0.8).toInt()
+ windowAnimations = R.style.dialog_anim_style
+ }
+ window?.setBackgroundDrawableResource(android.R.color.transparent)
+ window?.setGravity(Gravity.CENTER)
+ show()
+ }
+ }
+ }
+
fun showBottomDialog(
activity: Activity?,
anchorView: View,
--
Gitblit v1.9.3