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
mDataBinding.recyclerview.setAdapter(new GenericAdapter<String, ListitemGenericAdapterBinding>(this,getStringsList()) { | |
@Override | |
public int getLayoutResId() { | |
return R.layout.listitem_generic_adapter; | |
} | |
@Override | |
public void onBindData(String model, int position, ListitemGenericAdapterBinding dataBinding) { | |
dataBinding.txtName.setText("String " + position); | |
} |
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
public class SampleAdapter extends GenericAdapter<Model, ListitemGenericAdapterBinding> { | |
public SampleAdapter(Context context, ArrayList<Model> arrayList) { | |
super(context, arrayList); | |
} | |
@Override | |
public int getLayoutResId() { | |
return R.layout.listitem_generic_adapter; | |
} |
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
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); |
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
public class CustomTextView extends AppCompatTextView { | |
public CustomTextView(Context context) { | |
super(context); | |
} | |
public CustomTextView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
setFont(context, attrs); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<declare-styleable name="CustomTextView"> | |
<attr name="fontname" format="integer"> | |
<enum name="UbuntuRegular" value="1" /> | |
<enum name="UbuntuBold" value="2" /> | |
<enum name="UbuntuItalic" value="3" /> | |
</attr> | |
</declare-styleable> |
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
<com.manojbhadane.customtextview.CustomTextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Ubuntu Regular" | |
android:textSize="25sp" | |
app:fontname="UbuntuRegular" /> |
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
![alt text](https://github.com/manojbhadane/CustomTexView/blob/master/sc_customtextview.png) |
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
// Init | |
PaymentCardView paymentCard = (PaymentCardView) findViewById(R.id.creditCard); | |
// Options | |
paymentCard.setCardTitle("Pay Now"); // set from xml as well | |
paymentCard.setSubmitButtonText("Done"); // set from xml as well | |
// Callbacks |
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
Step 1. Add the JitPack repository to your build file | |
<repositories> | |
<repository> | |
<id>jitpack.io</id> | |
<url>https://jitpack.io</url> | |
</repository> | |
</repositories> | |
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
//Step 1. Add the JitPack repository to your build file | |
allprojects { | |
repositories { | |
... | |
maven { url 'https://jitpack.io' } | |
} | |
} | |
OlderNewer