Skip to content

Instantly share code, notes, and snippets.

@ditn
Created April 26, 2018 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ditn/0290f7d3dae1bc75f42a7464d6b3fec2 to your computer and use it in GitHub Desktop.
Save ditn/0290f7d3dae1bc75f42a7464d6b3fec2 to your computer and use it in GitHub Desktop.
Naive Kotlin builder use
val builder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(icon)
// Excluded for brevity
.ternaryBuilder(
{ AndroidUtils.is19orHigher() },
{ setVibrate(longArrayOf(100)) },
{ setVibrate(longArrayOf()) }
)
.setContentText(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment