/** * Created by Lison on 7/9/2019. * * http://lison.cc */ class AlerterUtil( val activity: Activity, val title: String, val titleId: Int, val text: String, val textId: Int, val backgroundColor: Int, val icon: Int, val showAlertListener: OnShowAlertListener, val hideAlertListener: OnHideAlertListener ) { private constructor(builder: Builder) : this(builder.activity, builder.title, builder.titleId, builder.text, builder.textId, builder.backgroundColor, builder.icon, builder.showAlertListener, builder.hideAlertListener)
class Builder {
/** lateinit 可以只創建變量不賦值 **/ lateinit var activity: Activity private set var title: String = "" private set var titleId: Int = 0 private set var text: String = "" private set var textId: Int = 0 private set var backgroundColor: Int = 0 private set var icon: Int = 0 private set
var showAlertListener: OnShowAlertListener = OnShowAlertListener { } private set var hideAlertListener: OnHideAlertListener = OnHideAlertListener { } private set