Last active
December 24, 2015 05:49
-
-
Save stanch/6752935 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
// apply optional tweak: Option[Tweak[_]] | |
def large(implicit ctx: Context): Option[Tweak[TextView]] = hdpi ? TextSize.large | |
myTextView ~> large | |
// apply a list of tweaks: List[Tweak[_]] | |
myButton ~> List(text("The red button"), id(Id.redButton)) | |
// functional reactive programming: Rx[Tweak[_]] | |
val caption = rx.Var("Olá") | |
myTextView ~> caption.map(c ⇒ text(c)) // sets text to “Olá” | |
caption.update("Adeus") // text automatically updates to “Adeus” | |
// apply tweak to a list of widgets: List[View] ~> Tweak[_] | |
List(myButton, myTextView) ~> hide | |
// apply optional tweak to a list of widgets: List[View] ~> Option[Tweak[_]] | |
List(myButton, myTextView) ~> (hdpi ? hide) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment