I hereby claim:
- I am danherrera on github.
- I am danherrera (https://keybase.io/danherrera) on keybase.
- I have a public key ASCXdlSUJqcKoITjr1Sabpl6s2M_0Dh5STSx4HUBXY5Pugo
To claim this, I am signing this object:
Video Player* | |
Play Video* | |
preroll -> Ad | |
no ad -> First Frame | |
First Frame | |
continue -> Video Playing | |
open class Event<out T>(private val content: T) { | |
var consumed = false | |
private set | |
fun consume(): T? { | |
return if (consumed) { | |
null | |
} else { | |
consumed = true | |
content |
typealias StringResource = Either<String, AndroidStringResource> | |
data class AndroidStringResource( | |
val id: Int, | |
val args: List<String> = emptyList() | |
) | |
fun Fragment.getString(resource: StringResource): String { | |
return when (resource) { | |
is Left -> resource.a |
I hereby claim:
To claim this, I am signing this object:
// Within onViewCreated | |
fun updateViewBasedOnPin(pin: String) { | |
binding.digit1.text = pin.getOrNull(0)?.toString() | |
binding.digit2.text = pin.getOrNull(1)?.toString() | |
binding.digit3.text = pin.getOrNull(2)?.toString() | |
binding.digit4.text = pin.getOrNull(3)?.toString() | |
binding.digit1Underline.setBackgroundColor(if (pin.isNotEmpty()) Color.YELLOW else Color.DKGRAY) | |
binding.digit2Underline.setBackgroundColor(if (pin.length > 1) Color.YELLOW else Color.DKGRAY) | |
binding.digit3Underline.setBackgroundColor(if (pin.length > 2) Color.YELLOW else Color.DKGRAY) | |
binding.digit4Underline.setBackgroundColor(if (pin.length > 3) Color.YELLOW else Color.DKGRAY) |
sealed class QuaternaryCase<T> { | |
data class Both<T>(val a: T, val b: T) : QuaternaryCase<T>() | |
data class OnlyA<T>(val a: T) : QuaternaryCase<T>() | |
data class OnlyB<T>(val b: T) : QuaternaryCase<T>() | |
class None<T> : QuaternaryCase<T>() | |
} | |
fun <T, R> Option<T>.map2Case(b: Option<T>, f: (case: QuaternaryCase<T>) -> R): R { | |
return Ior.fromOptions(this, b) | |
.map { ior -> |