Adding the npm package dependency:
yarn add @material-ui/core
Usage in Javascript (ECMAScript):
import Button from 'material-ui/core/Button';
import PropTypes from 'prop-types';
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 -> |
// 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) |
I hereby claim:
To claim this, I am signing this object:
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 |
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 |
Video Player* | |
Play Video* | |
preroll -> Ad | |
no ad -> First Frame | |
First Frame | |
continue -> Video Playing | |