pull/475/head
gedoor 5 years ago
parent b4909f1500
commit ab46a7713f
  1. 12
      app/src/main/java/io/legado/app/lib/dialogs/AlertBuilder.kt

@ -96,23 +96,23 @@ interface AlertBuilder<out D : DialogInterface> {
fun show(): D fun show(): D
fun AlertBuilder<*>.customTitle(view: () -> View) { fun customTitle(view: () -> View) {
customTitle = view() customTitle = view()
} }
fun AlertBuilder<*>.customView(view: () -> View) { fun customView(view: () -> View) {
customView = view() customView = view()
} }
fun AlertBuilder<*>.okButton(handler: ((dialog: DialogInterface) -> Unit)? = null) = fun okButton(handler: ((dialog: DialogInterface) -> Unit)? = null) =
positiveButton(android.R.string.ok, handler) positiveButton(android.R.string.ok, handler)
fun AlertBuilder<*>.cancelButton(handler: ((dialog: DialogInterface) -> Unit)? = null) = fun cancelButton(handler: ((dialog: DialogInterface) -> Unit)? = null) =
negativeButton(android.R.string.cancel, handler) negativeButton(android.R.string.cancel, handler)
fun AlertBuilder<*>.yesButton(handler: ((dialog: DialogInterface) -> Unit)? = null) = fun yesButton(handler: ((dialog: DialogInterface) -> Unit)? = null) =
positiveButton(R.string.yes, handler) positiveButton(R.string.yes, handler)
fun AlertBuilder<*>.noButton(handler: ((dialog: DialogInterface) -> Unit)? = null) = fun noButton(handler: ((dialog: DialogInterface) -> Unit)? = null) =
negativeButton(R.string.no, handler) negativeButton(R.string.no, handler)
} }

Loading…
Cancel
Save