Hey Nick,
I have a question about the this
line: userListable.listAdapterTweak(User("Terry"), User("Graham"))
The way I understand tweaks is that they are mutable effects to
layouts/views. In this case, is a ListAdapterTweak also a method to modify
the display of the ListAdapeter? If so, where can I see what it actually
does and how can I compose them?
On Thursday, July 31, 2014 6:41:36 PM UTC-4, Nick Stanchenko wrote:
>
> Hi,
>
> Here’s a new library I wrote under the *Macroid* umbrella project:
> Macroid-Viewable: http://macroid.github.io/related/Viewable.html
> It provides three main advantages:
>
> - A clear way to declare how your data should be displayed
> - Boilerplate-free ListAdapters and PagerAdapters
> - Macroid’s trademark emphasis on composability
>
> A quick example of displaying Alice and Bob in a list (with font size
> proportional to their age):
>
> import macroid._
> import macroid.FullDsl._
> import macroid.viewable._
>
> // our data type
> case class User(name: String, age: Int)
>
> // defines how to view a User in a list
> implicit def userListable(implicit ctx: ActivityContext, appCtx:
> AppContext) =
> Listable[User].tw {
> // the layout is a TextView
> w[TextView]
> } { user ⇒
> // to display a user, we tweak the layout
> text(user.name) + TextTweaks.size(user.age + 10)
> }
>
> // now we simply tweak the ListView
> myListView <~ List(User("Alice", 12), User("Bob", 23)).listAdapterTweak
>
> Please follow the link above for more documentation and cool features.
> Also note that I’ve just submitted the library to the jCenter repo, but
> until it arrives there, you might need to use the following resolver:
>
> resolvers += "stanch@Bintray" at "http://dl.bintray.com/stanch/maven/"
>
> Looking forward to hearing your feedback,
> Nick
>
>
--
You received this message because you are subscribed to the Google Groups
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.