Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorth committed Jun 30, 2015
1 parent 3d96310 commit df45fc1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Android Card Form Release Notes

## 2.0.0

* Material design updates
* Prevent screenshots of the card form using `FLAG_SECURE`
* Add sample app
* Update gradle build tools to 1.2.3
* Breaking Changes
* `CardForm#setRequriedFields` now requires an `Activity` and is no longer optional. Failure to call `CardForm#setRequiredFields` will result in an invisible form.
* Remove methods to save form instance state, instance state is automatically saved
* Fixes
* Strip metadata from assets
* Fix crash on API 10 caused by `View#focuseSearch`

## 1.4.0

* Fixes
Expand Down
4 changes: 2 additions & 2 deletions CardForm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 20
versionName '1.4.0'
versionCode 21
versionName '2.0.0'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In your `build.gradle`:

```groovy
dependencies {
compile project('com.braintreepayments:card-form:1.4.0')
compile project('com.braintreepayments:card-form:2.0.0')
}
```

Expand All @@ -26,13 +26,12 @@ Card Form is a LinearLayout that you can add to your layout:
android:layout_height="match_parent" />
```

To change which fields are required for the user to enter, use
`CardForm#setRequiredFields(boolean cardNumberRequired, boolean expirationRequired, boolean cvvRequired, boolean postalCodeRequired, String imeActionLabel)`.
By default all fields are required.
To initialize the view and change which fields are required for the user to enter, use
`CardForm#setRequiredFields(Activity activity, boolean cardNumberRequired, boolean expirationRequired, boolean cvvRequired, boolean postalCodeRequired, String imeActionLabel)`.

```java
CardForm cardForm = (CardForm) findViewById(R.id.bt_card_form);
cardForm.setRequiredFields(true, true, false, false, "Purchase");
cardForm.setRequiredFields(Activity.this, true, true, false, false, "Purchase");
```

To access the values in the form, there are getters for each field:
Expand All @@ -45,16 +44,22 @@ cardForm.getCvv();
cardForm.getPostalCode();
```

To check if `CardForm` is valid simply call `CardForm#isValid()`. To validate each required field
and show the user which fields are incorrect, call `CardForm#validate()`. There are also setters
for each field that allow you to set if they are valid or not and display an error to the user.
To check if `CardForm` is valid call `CardForm#isValid()`. To validate each required field
and show the user which fields are incorrect, call `CardForm#validate()`.

Additionally `CardForm` has 3 available listeners that can be set on it.
Additionally `CardForm` has 3 available listeners:

* `CardForm#setOnCardFormValidListener` called when the form changes state from valid to invalid or invalid to valid.
* `CardForm#setOnCardFormSubmitListener` called when the form should be submitted.
* `CardForm#setOnFormFieldFocusedListener` called when a field in the form is focused.

## Styling

All card form inputs use the `colorPrimary` theme attribute, when present, to set their focused color.
For more information on the `colorPrimary` attribute, see [Using the Material Theme](https://developer.android.com/training/material/theme.html).

The included [sample app](https://github.com/braintree/android-card-form/tree/master/Sample) has examples of a Holo theme, Material light theme and Material dark theme.

## [Change Log](CHANGELOG.md)

## License
Expand Down
4 changes: 2 additions & 2 deletions Sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'com.braintreepayments.sample'
minSdkVersion 15
targetSdkVersion 22
versionCode 20
versionName '1.4.0'
versionCode 21
versionName '2.0.0'
}
}

Expand Down

0 comments on commit df45fc1

Please sign in to comment.