mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-26 22:26:29 +08:00
fix cctv6
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.DialogFragment
|
||||
|
||||
class ConfirmationDialogFragment(private val listener: ConfirmationDialogListener) :
|
||||
DialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return activity?.let {
|
||||
val builder = AlertDialog.Builder(it)
|
||||
builder.setTitle("确认")
|
||||
.setMessage("确认更新吗?")
|
||||
.setPositiveButton(
|
||||
"确定"
|
||||
) { _, _ ->
|
||||
listener.onConfirm()
|
||||
}
|
||||
.setNegativeButton(
|
||||
"取消"
|
||||
) { _, _ ->
|
||||
listener.onCancel()
|
||||
}
|
||||
// 创建并返回 AlertDialog 对象
|
||||
builder.create()
|
||||
} ?: throw IllegalStateException("Activity cannot be null")
|
||||
}
|
||||
|
||||
interface ConfirmationDialogListener {
|
||||
fun onConfirm()
|
||||
fun onCancel()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user