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
private val rand = Random(0) | |
private const val CELL_SIZE = 50 | |
private val ALIVE_COLOR = Color.White | |
private val DEAD_COLOR = Color.Black | |
private val BooleanToVector: TwoWayConverter<Boolean, AnimationVector1D> = TwoWayConverter( | |
{ AnimationVector1D(if (it) 1f else 0f) }, | |
{ it.value == 1f } | |
) | |
@Composable |
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
private val PARTICLE_COLOR = Color.White | |
private val LINE_COLOR = Color.White | |
private const val PARTICLE_QUANTITY = 100 | |
private const val DEFAULT_SPEED = 2 | |
private const val VARIANT_SPEED = 1 | |
private const val DEFAULT_RADIUS = 4 | |
private const val VARIANT_RADIUS = 2 | |
private const val LINK_RADIUS = 200 | |
// TODO: 30/09/2020 These should be measured but are only used to calculate | |
// the initial position |
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
fun TransactionSender.logTransaction(eventLogger: EventLogger): TransactionSender = | |
TransactionLogger(this, eventLogger) |
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 ktlint by configurations.creating | |
dependencies { | |
ktlint(Libraries.ktlint) | |
} | |
tasks.register<JavaExec>("ktlint") { | |
group = "verification" | |
description = "Check Kotlin code style." | |
classpath = ktlint |
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
Verifying my Blockstack ID is secured with the address 16RnXJ8orEyoEdZGWYQRRxudjrYuQNPoYS https://explorer.blockstack.org/address/16RnXJ8orEyoEdZGWYQRRxudjrYuQNPoYS |
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()) | |
} | |
} |
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
fun <T> T.ternaryBuilder( | |
predicate: () -> Boolean, | |
trueFunc: T.() -> T, | |
falseFunc: T.() -> T | |
): T = if (predicate()) this.trueFunc() else this.falseFunc() |
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 | |
.ternaryBuilder( | |
{ AndroidUtils.is19orHigher() }, | |
{ setVibrate(longArrayOf(100)) }, | |
{ setVibrate(longArrayOf()) } | |
) | |
.setContentText(text) |
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
private fun NotificationCompat.Builder.ternaryBuilder( | |
predicate: () -> Boolean, | |
trueFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder, | |
falseFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder | |
): NotificationCompat.Builder = if (predicate()) this.trueFunc() else this.falseFunc() |
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 | |
.setContentText(text) | |
if (AndroidUtils.is19orHigher()) { | |
builder.setVibrate(longArrayOf(100)) | |
} else { | |
builder.setVibrate(longArrayOf()) | |
} |
NewerOlder