Created
September 29, 2013 13:45
-
-
Save stanch/6752653 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
trait MyStyles extends LayoutDsl with MediaQueries with ExtraTweaks { | |
// sets text, large font size and a long click handler | |
def caption(cap: String)(implicit ctx: Context): Tweak[TextView] = | |
text(cap) + TextSize.large + On.longClick { | |
Toast.makeText(ctx, "I’m a caption", Toast.LENGTH_SHORT).show() | |
true | |
} | |
// sets large font size for high-density screens, medium font size for medium-density screens | |
// does nothing in other cases | |
def adaptiveSize(implicit ctx: Context): Option[Tweak[TextView]] = | |
hdpi ? TextSize.large | mdpi ? TextSize.medium | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment