Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class NotificationBuilder(
context: Context
) : ResourcedBuilder by context() {
var contentText: CharSequence? by optional { contentTextRes }
@StringRes var contentTextRes: Int? = null
var title: CharSequence by required { titleRes }
@get:StringRes var titleRes: Int? = null
@get:DrawableRes var smallIconRes: Int by required()
internal fun build(): Notification {
return builder
.setContentTitle( title )
.apply { contentText?.let { setContentText( it ) } }
...
.build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment