Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from hannta/master
Browse files Browse the repository at this point in the history
Move hint texts to string resources
  • Loading branch information
paynd authored Feb 1, 2018
2 parents d169f7a + 6d8e85f commit 7df3c97
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CreditCardEntry/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
<string name="ExpirationDateHelp">Expiration date (MM/YY)</string>
<string name="SecurityCodeHelp">Security code (CVV)</string>
<string name="ZipHelp">Zip code of billing address</string>
<string name="SecurityCodeFieldHint">CVV</string>
<string name="ExpDateFieldHint">MM/YY</string>
<string name="ZipCodeFieldHint"> ZIP </string>
<string name="CreditCardFormCardNumberHint">1234 5678 9012 3456</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ExpDateText(Context context, AttributeSet attrs, int defStyle) {

void init() {
super.init();
setHint("MM/YY");
setHint(R.string.ExpDateFieldHint);
}

/* TextWatcher Implementation Methods */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public SecurityCodeText(Context context, AttributeSet attrs, int defStyle) {

void init() {
super.init();
setHint("CVV");
setHint(R.string.SecurityCodeFieldHint);
}

/* TextWatcher Implementation Methods */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void init() {
super.init();
maxChars = 5;
setMaxChars(maxChars);
setHint(" ZIP ");
setHint(R.string.ZipCodeFieldHint);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CreditCardForm extends RelativeLayout {
private Drawable inputBackground;
private boolean useDefaultColors;
private boolean animateOnError;
private String cardNumberHint = "1234 5678 9012 3456";
private String cardNumberHint;

public CreditCardForm(Context context) {
this(context, null);
Expand Down Expand Up @@ -76,7 +76,7 @@ public CreditCardForm(Context context, AttributeSet attrs, int defStyle) {
}

// defaults if not set by user
if(cardNumberHint == null) cardNumberHint = "1234 5678 9012 3456";
if(cardNumberHint == null) cardNumberHint = context.getResources().getString(R.string.CreditCardFormCardNumberHint);
if(inputBackground == null) {
//noinspection deprecation
inputBackground = context.getResources().getDrawable(R.drawable.background_white);
Expand Down

0 comments on commit 7df3c97

Please sign in to comment.