Created
April 26, 2018 10:36
-
-
Save ditn/c9eb85f4d5e3664323a6f80b17420dbc to your computer and use it in GitHub Desktop.
Idiomatic ternary function in Kotlin
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
val builder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID) | |
.setSmallIcon(icon) | |
// Excluded for brevity | |
.apply { | |
if (AndroidUtils.is19orHigher()) { | |
setVibrate(longArrayOf(100)) | |
} else { | |
setVibrate(longArrayOf()) | |
} | |
} | |
.setContentText(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment