Class GiftcardsViewHolder
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.ViewHolder
-
- com.cheetahdigital.giftcards.ui.list.GiftcardsViewHolder
-
public class GiftcardsViewHolder extends androidx.recyclerview.widget.RecyclerView.ViewHolder
The View Holder for the list ofGiftcard
Contains all the views to be displayed on each list item
-
-
Field Summary
Fields Modifier and Type Field Description android.widget.TextView
mCardNumber
android.widget.TextView
mGiftCardBalance
android.widget.TextView
mGiftCardDaysLeft
android.widget.TextView
mGiftCardDescription
android.widget.TextView
mGiftCardExpiration
android.widget.TextView
mGiftCardLabel
android.widget.TextView
mGiftCardName
android.view.View
mRootView
android.widget.ImageView
mThumbImageView
-
Constructor Summary
Constructors Constructor Description GiftcardsViewHolder(android.view.View itemView)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(Giftcard giftcard)
Method to bind and display theGiftcard
to theGiftcardsViewHolder
protected java.lang.String
formatDaysLeft(int daysLeft)
Formats the days left based on the usage end date of the gift card.void
setPlaceHolderResource(int placeHolderResource)
Set the placeholder resource in the avatar view
-
-
-
Field Detail
-
mRootView
public android.view.View mRootView
-
mThumbImageView
public android.widget.ImageView mThumbImageView
-
mCardNumber
public android.widget.TextView mCardNumber
-
mGiftCardName
public android.widget.TextView mGiftCardName
-
mGiftCardDescription
public android.widget.TextView mGiftCardDescription
-
mGiftCardBalance
public android.widget.TextView mGiftCardBalance
-
mGiftCardExpiration
public android.widget.TextView mGiftCardExpiration
-
mGiftCardDaysLeft
public android.widget.TextView mGiftCardDaysLeft
-
mGiftCardLabel
public android.widget.TextView mGiftCardLabel
-
-
Method Detail
-
bind
public void bind(Giftcard giftcard)
Method to bind and display theGiftcard
to theGiftcardsViewHolder
- Parameters:
giftcard
- theGiftcard
to display
-
formatDaysLeft
@NonNull protected java.lang.String formatDaysLeft(int daysLeft)
Formats the days left based on the usage end date of the gift card. Default format is using R.plurals.days_left. Override this method to change the default display of days left.- Parameters:
daysLeft
- number of days left- Returns:
- formatted number of days left
-
setPlaceHolderResource
public void setPlaceHolderResource(@DrawableRes int placeHolderResource)
Set the placeholder resource in the avatar view- Parameters:
placeHolderResource
-DrawableRes
id of the place holder resource
-
-