Created
June 17, 2014 23:26
-
-
Save stanch/13430a4657798f3a43b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 rx1 = Var(1) | |
val rx2 = Var(2) | |
val rx3 = Rx { rx1() + rx2() } | |
// ... | |
val style = TextSize.large + padding(all = 16 dp) | |
def rxText(rx: Rx[Int]) = rx.map(_.toString).map(text) | |
def rxClick(rx: Var[Int]) = On.click(Ui { | |
rx() = rx() + 1 | |
}) | |
val view = l[VerticalLinearLayout]( | |
w[Button] <~ style <~ rxText(rx1) <~ rxClick(rx1), | |
w[Button] <~ style <~ rxText(rx2) <~ rxClick(rx2), | |
w[Button] <~ style <~ rxText(rx3) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment