View binding library
APACHE-2.0 License
##Android View initializer and Click Listener boiler plate code remover
####This library is based on the ideas of removing boilerplate code like ButterKnife but with use cases targeted for view binding of xml. Resulting is a vey tiny library.
##@BindView
annotation to refer any view defined in XML
@BindView(R.id.txtView)
public TextView textView1;
##@OnClick
annotation to set onClick method for any view defined in XML
@OnClick(R.id.btn1)
public void onBtn1Click(){
textView1.setText("Btn 1 click");
}
##@OnLongClick
annotation to set OnLongClick method for any view defined in XML
@OnLongClick(R.id.btn2)
private void onBtn2LongClick(){
txtView.setText("Btn 2 long click");
}
##For Any class with inflated view from XML can be used as described below ##For example in a Fragment
public class MyFragment extends Fragment {
@BindView(R.id.txtView)
public TextView txtView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View promptsView = inflater.inflate(R.layout.my_fragment, container, false);
ButterKnifeLite.bind(this, promptsView);
return promptsView;
}
@OnClick(R.id.btn1)
public void onBtn1Click(){
txtView.setText("Btn 1 frag click");
}
@OnClick(R.id.btn2)
public void onBtn2Click(){
txtView.setText("Btn 2 frag click");
}
}
#Gradle
compile 'com.mindorks:butterknifelite:0.0.3'
-keepattributes *Annotation*
-keepclassmembers class ** {
@com.mindorks.butterknifelite.annotations.** <methods>;
}
PlaceHolderView
helps create views without any adapter in a very modular form. It uses the power of RecyclerView and enhances it to another level. For the first time with the list view comes card stack view.JPost
library