Skip to content

Instantly share code, notes, and snippets.

@stanch
Last active December 24, 2015 05:49
Show Gist options
  • Save stanch/6752935 to your computer and use it in GitHub Desktop.
Save stanch/6752935 to your computer and use it in GitHub Desktop.
// 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