Created
May 3, 2019 14:06
-
-
Save fardavide/4c08d6c8d54d2e26f2f5d8cc5bf0fcd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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