Skip to content

Instantly share code, notes, and snippets.

View manojbhadane's full-sized avatar

Manoj manojbhadane

View GitHub Profile
mDataBinding.recyclerview.setAdapter(new GenericAdapter<String, ListitemGenericAdapterBinding>(this,getStringsList()) {
public int getLayoutResId() {
return R.layout.listitem_generic_adapter;
public void onBindData(String model, int position, ListitemGenericAdapterBinding dataBinding) {
dataBinding.txtName.setText("String " + position);
public abstract class GenericAdapter<T, D> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context mContext;
private ArrayList<T> mArrayList;
public abstract int getLayoutResId();
public abstract void onBindData(T model, int position, D dataBinding);
public abstract void onItemClick(T model, int position);
public class SampleAdapter extends GenericAdapter<Model, ListitemGenericAdapterBinding> {
public SampleAdapter(Context context, ArrayList<Model> arrayList) {
super(context, arrayList);
public int getLayoutResId() {
return R.layout.listitem_generic_adapter;
public class CustomTextView extends AppCompatTextView {
public CustomTextView(Context context) {
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setFont(context, attrs);
<?xml version="1.0" encoding="utf-8"?>
<declare-styleable name="CustomTextView">
<attr name="fontname" format="integer">
<enum name="UbuntuRegular" value="1" />
<enum name="UbuntuBold" value="2" />
<enum name="UbuntuItalic" value="3" />
android:text="Ubuntu Regular"
app:fontname="UbuntuRegular" />
manojbhadane / CustomTextView.png
Created July 11, 2018 15:24
![alt text](
// Init
PaymentCardView paymentCard = (PaymentCardView) findViewById(;
// Options
paymentCard.setCardTitle("Pay Now"); // set from xml as well
paymentCard.setSubmitButtonText("Done"); // set from xml as well
// Callbacks
Step 1. Add the JitPack repository to your build file
//Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
maven { url '' }