View example.kts
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 example = when (lightType) { | |
LightBulb -> ... | |
LightStrip -> ... | |
FloodLight -> ... | |
} |
View example.kts
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
if (myLight == LightType.FloodLight) { | |
TODO() | |
} |
View example.kts
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 example = when (myLight) { | |
LightBulb -> TODO() | |
LightStrip -> TODO() | |
FloodLight -> TODO() | |
else -> TODO() // This else is *required* now | |
} |
View LightType.kt
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
enum class LightType { | |
LightBulb, | |
LightStrip, | |
FloodLight, | |
} |
View LightType.kt
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
value class LightType private constructor( | |
private val type: String, | |
) { | |
companion object { | |
val LightBulb = LightType("light_bulb") | |
val LightStrip = LightType("light_strip") | |
val FloodLight = LightType("flood_light") | |
} | |
} |
View LightType.kt
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
value class LightType private constructor( | |
private val type: String, | |
) { | |
companion object { | |
val LightBulb = LightType("light_bulb") | |
val LightStrip = LightType("light_strip") | |
val FloodLight = LightType("flood_light") | |
fun values() = arrayOf(LightBulb, LightStrip, FloodLight) | |
} |
View LightType.kt
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
value class LightType private constructor( | |
private val type: String, | |
) { | |
companion object { | |
val LightBulb = LightType("light_bulb") | |
val LightStrip = LightType("light_strip") | |
val FloodLight = LightType("flood_light") | |
fun values() = arrayOf(LightBulb, LightStrip, FloodLight) | |
} |
View LightType.kt
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
value class LightType private constructor( | |
private val type: string, | |
) { | |
companion object { | |
val LightBulb = LightType("light_bulb") | |
val LightStrip = LightType("light_strip") | |
val FloodLight = LightType("flood_light") | |
fun values() = arrayOf(LightBulb, LightStrip, FloodLight) | |
} |
View gist:4805968873b4f1a4084c2aed2369d1e6
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS | |
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGmCwwXHR4lVSRudWxs1Q0ODxAR | |
EhMUFRZcTlNDb21wb25lbnRzVU5TUkdCXE5TQ29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29s | |
b3JTcGFjZVYkY2xhc3NPECcwLjEwNTg4MjM1MjkgMC4xMjE1Njg2Mjc1IDAuMTM3MjU0 |
View UserInfo.kt
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 UserInfoFormatter( | |
private val resources: Resources | |
) { | |
fun getDisplayName(user: User) { | |
if (user.name.isNullOrEmpty()) { | |
return resources.getString(R.string.name_unknown) | |
} else { | |
return user.name | |
} | |
} |
NewerOlder