Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class CreditCardView extends FrameLayout {

private CreditCardUtils.CardType mCardType;

private boolean alwaysHideFrontCvv;
private boolean changeCardColor;
private boolean showCardAnimation;

Expand Down Expand Up @@ -103,6 +104,7 @@ private void init(AttributeSet attrs) {
String expiry = a.getString(R.styleable.creditcard_card_expiration);
String cardNumber = a.getString(R.styleable.creditcard_card_number);

alwaysHideFrontCvv = a .getBoolean(R.styleable.creditcard_always_hide_front_cvv, false);
changeCardColor = a.getBoolean(R.styleable.creditcard_change_card_color, true);
showCardAnimation = a.getBoolean(R.styleable.creditcard_show_card_animation, true);
boolean showChipOnCard = a.getBoolean(R.styleable.creditcard_show_chip_on_card, true);
Expand All @@ -112,7 +114,7 @@ private void init(AttributeSet attrs) {
chipContainer.setVisibility(View.INVISIBLE);
}
}

int cvv = a.getInt(R.styleable.creditcard_cvv, 0);
int cardSide = a.getInt(R.styleable.creditcard_card_side,CreditCardUtils.CARD_SIDE_FRONT);

Expand Down Expand Up @@ -188,7 +190,9 @@ public void setCardNumber(String rawCardNumber) {
String cardNumber = CreditCardUtils.formatCardNumber(this.mRawCardNumber, CreditCardUtils.SPACE_SEPERATOR);

((TextView)findViewById(TEXTVIEW_CARD_NUMBER_ID)).setText(cardNumber);
((TextView)findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setVisibility(mCardType == CreditCardUtils.CardType.AMEX_CARD ? View.VISIBLE : View.GONE);
if(!alwaysHideFrontCvv) {
((TextView) findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setVisibility(mCardType == CreditCardUtils.CardType.AMEX_CARD ? View.VISIBLE : View.GONE);
}

if(this.mCardType != CreditCardUtils.CardType.UNKNOWN_CARD) {
this.post(new Runnable() {
Expand Down
1 change: 1 addition & 0 deletions creditcarddesign/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<attr name="show_card_animation" format="boolean"/>
<attr name="show_chip_on_card" format="boolean"/>

<attr name="always_hide_front_cvv" format="boolean"/>

</declare-styleable>
</resources>