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.