Last active
January 1, 2017 15:06
-
-
Save mrmans0n/b1efdc0a7c4ea72056ed2f9136371773 to your computer and use it in GitHub Desktop.
Binder template for Drebin
This file contains 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
#parse("File Header.java") | |
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end | |
import drebin.core.Binder; | |
import drebin.core.BinderEnvironment; | |
import drebin.core.ViewFactory; | |
import drebin.core.ViewHost; | |
public class ${Model}Binder implements Binder<${ViewClass}, ${Model}Binder.${Model}ViewHost, ${Model}, BinderEnvironment> { | |
private static final ViewFactory<${ViewClass}> VIEW_FACTORY = ViewFactory.INFLATE.fromLayout(R.layout.${LayoutRes}); | |
public ${Model}Binder() { | |
} | |
@Override public ViewFactory<${ViewClass}> getViewFactory() { | |
return VIEW_FACTORY; | |
} | |
@Override public ${Model}ViewHost createViewHost(${ViewClass} view) { | |
return new ${Model}ViewHost(view); | |
} | |
@Override public void bind(${Model} model, ${Model}ViewHost viewHost, BinderEnvironment environment) { | |
// Bind your model here | |
} | |
@Override public void unbind(${Model}ViewHost viewHost, BinderEnvironment environment) { | |
} | |
static class ${Model}ViewHost extends ViewHost<${ViewClass}> { | |
public ${Model}ViewHost(${ViewClass} view) { | |
super(view); | |
// Inject your views here, i.e.: | |
// ButterKnife.bind(this, view); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment