xebia-functional / macroid

A modular functional UI language for Android
527 stars 37 forks source link

Adding implicit ContextWrapper for Views #79

Closed javipacheco closed 8 years ago

javipacheco commented 8 years ago

This PR brings the ability to create ContextWrapper implicit in our custom views

For now, if you are using XML Layouts and you need ContextWrapper there isn't an easy way for do it. With this contribution, we can do that:

class MyFrameLayout(context: Context, attr: AttributeSet, defStyleAttr: Int)
  extends FrameLayout(context, attr, defStyleAttr)
  with Contexts[View] {

  def this(context: Context) = this(context, javaNull, 0)

  def this(context: Context, attr: AttributeSet) = this(context, attr, 0)

....

}

@stanch can you please review? Thanks!

stanch commented 8 years ago

Thanks! Just a few minor comments — see above.

javipacheco commented 8 years ago

I've addressed the changes. @stanch can you please review? thanks!

stanch commented 8 years ago

LGTM, could you add your changes to the docs? https://github.com/47deg/macroid/blob/master/macroid-docs/guide/Contexts.md#contexts

javipacheco commented 8 years ago

@stanch I've added the changes to the docs :+1: