操作密码弹窗修改2

This commit is contained in:
2026-06-02 16:45:31 +08:00
parent a1b9acb2a6
commit 5822e562de
9 changed files with 261 additions and 314 deletions

View File

@@ -22,6 +22,7 @@ class PasswordInputDialog(context: Context) : Dialog(context) {
private lateinit var binding: DialogPasswordInputBinding
private var onConfirmListener: ((String) -> Unit)? = null
private var onDismissListener: (() -> Unit)? = null
private var customTitle: String? = null
// 6个密码输入框数组
private lateinit var passwordEditTexts: Array<EditText>
@@ -61,6 +62,11 @@ class PasswordInputDialog(context: Context) : Dialog(context) {
setupPasswordInput()
// 设置标题(如果通过 setTitle 设置了自定义标题)
customTitle?.let {
binding.tvTitle.text = it
}
binding.ivClose.setOnClickListener {
dismiss()
}
@@ -239,6 +245,14 @@ class PasswordInputDialog(context: Context) : Dialog(context) {
return this
}
fun setTitle(title: String): PasswordInputDialog {
this.customTitle = title
if (::binding.isInitialized) {
binding.tvTitle.text = title
}
return this
}
fun setOnDismissListener(listener: () -> Unit): PasswordInputDialog {
this.onDismissListener = listener
return this