- A lightweight runtime ViewBinder.
- No code generation, uses reflection to bind references from xml.
- Simple annotations to eliminate findViewById calls.
- OnClick annotations to avoid setOnClickListener calls.
- No need to declare fields public in order to expose them to binders
Why use this when we have butterknife?
This library just includes ViewBinder and OnClick binding sources, which most of the project use. ButterKnife comes with a lot of other features that project rarely uses.
Available Version: 1.0.0 on jcenter
Minimum API Level is 21.
In your app level gradle (4.0+), add:
implementation 'net.crystalapps:mint-view-binder:1.0.0'
for gradle versions below 4.0 use:
compile 'net.crystalapps:mint-view-binder:1.0.0'
- For simple view binding:
@BindView( R.id.loginButton )
private Button loginButton;
- For binding multiple views:
@BindViews( { R.id.usernameTextView, R.id.statusTextView} )
private TextView[] textViews;
- For binding click listener:
@OnClick( { R.id.loginButton, R.id.signUpButton} )
private onClick(View v){
switch(v.getId()){
case R.id.loginButton:
// do something
break;
case R.id.signUpButton:
// do something
break;
}
}
Contributions are welcomed as long as they dont break the code. Please create an issue and have a discussion before pull request.
Hosted at JCenter: https://bintray.com/syedowaisali/maven/mint-view-binder
- Owais Ali - Initial work - @syedowaisali
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.
Sources from Android and Android APIs are subject to the licensing terms as per Android Open Source Project (AOSP).