Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Manoj Bhadane manojbhadane

🎯
Focusing
Block or report user

Report or block manojbhadane

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PaymentCardViewGradle.gradle
//Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
View PaymentCardViewMaven.xml
Step 1. Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
View PaymentCardView.java
// 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
View CustomTextView.png
![alt text](https://github.com/manojbhadane/CustomTexView/blob/master/sc_customtextview.png)
View activity_customview.xml
<com.manojbhadane.customtextview.CustomTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ubuntu Regular"
android:textSize="25sp"
app:fontname="UbuntuRegular" />
View attrs.xml
<?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>
View CustomTextView.java
public class CustomTextView extends AppCompatTextView {
public CustomTextView(Context context) {
super(context);
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setFont(context, attrs);
}
View SampleGenericAdapter.java
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;
}
View GenericAdapter.java
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);
View GenericAdapterActivity.java
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);
}
You can’t perform that action at this time.