epoxy-model
v1.0.0
Published
Epoxy model generator
Downloads
1
Maintainers
Readme
epoxy-model
Epoxy model generator
Install
$ npm i epoxy-model
Usage
$ epoxy-model <layout.xml> <name> <output>
Example
Given layout named holder_message.xml
with content as following:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/messageTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dp"
android:textAppearance="@style/Body1">
</TextView>
Execute
$ epoxy-model ./src/main/res/layout/holder_message.xml Message ./src/main/java/vn/tiki/android/app/view
Will generate TodoModel.kt
with content as following:
package vn.tiki.android.app.view
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import com.airbnb.epoxy.EpoxyModelWithHolder
import vn.tiki.android.app.view.MessageModel.Holder
@EpoxyModelClass(layout = R.layout.holder_message)
abstract class MessageModel : EpoxyModelWithHolder<Holder>() {
override fun bind(holder: Holder) {
super.bind(holder)
TODO("bind you model")
}
class Holder : KotlinEpoxyHolder() {
val messageTextView by bind<TextView>(R.id.messageTextView)
}
}
Author
- Giang Nguyen [email protected] (twitter)
Enjoy your work and say thanks :)