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

Commit

Permalink
Update library to 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Brateman committed Feb 23, 2015
1 parent c760acd commit 9c61c41
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All releases follow [semantic versioning](http://semver.org/).
The latest version is available via `mavenCentral()`. Just add the following dependency:

```
compile 'io.card:android-sdk:4.0.1'
compile 'io.card:android-sdk:4.0.2'
```

You can receive updates about new versions via a few different channels:
Expand Down
6 changes: 3 additions & 3 deletions SampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
applicationIdSuffix ".debug"
}

release{
release {
minifyEnabled true
proguardFile file('proguard.cfg')
signingConfig signingConfigs.myConfig
Expand All @@ -50,9 +50,9 @@ android {

dependencies {
if (parent != null) {
compile project (':card.io')
compile project(':card.io')
} else {
compile 'io.card:android-sdk:4.0.1'
compile 'io.card:android-sdk:4.0.2'
}
}

34 changes: 18 additions & 16 deletions SampleApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.my.scanExample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
package="org.my.scanExample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.VIBRATE"/>

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

<application android:label="card.io example" >
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

<application android:label="card.io example"
android:theme="@style/MyTheme">
<activity android:name="MyScanActivity"
android:label="card.io example">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" android:hardwareAccelerated="true"/>
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>


<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation"
android:hardwareAccelerated="true"/>
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>

</application>
</manifest>
154 changes: 76 additions & 78 deletions SampleApp/src/main/java/org/my/scanExample/MyScanActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,94 +10,92 @@
import io.card.payment.CardIOActivity;
import io.card.payment.CreditCard;

public class MyScanActivity extends Activity
{
final String TAG = getClass().getName();

private Button scanButton;
private TextView resultTextView;

private int MY_SCAN_REQUEST_CODE = 100; // arbitrary int

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

resultTextView = (TextView)findViewById(R.id.resultTextView);
scanButton = (Button)findViewById(R.id.scanButton);

resultTextView.setText("card.io library version: " + CardIOActivity.sdkVersion() + "\nBuilt: " + CardIOActivity.sdkBuildDate());
}

@Override
protected void onResume() {
super.onResume();

if (CardIOActivity.canReadCardWithCamera()) {
scanButton.setText("Scan a credit card with card.io");
}
else {
scanButton.setText("Enter credit card information");
}
}

public void onScanPress(View v) {
// This method is set up as an onClick handler in the layout xml
// e.g. android:onClick="onScanPress"

Intent scanIntent = new Intent(this, CardIOActivity.class);

// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: true
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false

// hides the manual entry button
// if set, developers should provide their own manual entry mechanism in the app
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); // default: false
public class MyScanActivity extends Activity {
final String TAG = getClass().getName();

private Button scanButton;
private TextView resultTextView;

private int MY_SCAN_REQUEST_CODE = 100; // arbitrary int

/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

resultTextView = (TextView) findViewById(R.id.resultTextView);
scanButton = (Button) findViewById(R.id.scanButton);

resultTextView.setText("card.io library version: " + CardIOActivity.sdkVersion() + "\nBuilt: " + CardIOActivity.sdkBuildDate());
}

@Override
protected void onResume() {
super.onResume();

if (CardIOActivity.canReadCardWithCamera()) {
scanButton.setText("Scan a credit card with card.io");
} else {
scanButton.setText("Enter credit card information");
}
}

public void onScanPress(View v) {
// This method is set up as an onClick handler in the layout xml
// e.g. android:onClick="onScanPress"

Intent scanIntent = new Intent(this, CardIOActivity.class);

// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: true
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false

// hides the manual entry button
// if set, developers should provide their own manual entry mechanism in the app
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); // default: false

// matches the theme of your application
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, false); // default: false

// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

String resultStr;
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
String resultStr;
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);

// Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber()
resultStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";
// Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber()
resultStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";

// Do something with the raw number, e.g.:
// myService.setCardNumber( scanResult.cardNumber );
// Do something with the raw number, e.g.:
// myService.setCardNumber( scanResult.cardNumber );

if (scanResult.isExpiryValid()) {
resultStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
}
if (scanResult.isExpiryValid()) {
resultStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
}

if (scanResult.cvv != null) {
// Never log or display a CVV
resultStr += "CVV has " + scanResult.cvv.length() + " digits.\n";
}
if (scanResult.cvv != null) {
// Never log or display a CVV
resultStr += "CVV has " + scanResult.cvv.length() + " digits.\n";
}

if (scanResult.postalCode != null) {
resultStr += "Postal Code: " + scanResult.postalCode + "\n";
}
}
else {
resultStr = "Scan was canceled.";
}
resultTextView.setText(resultStr);
if (scanResult.postalCode != null) {
resultStr += "Postal Code: " + scanResult.postalCode + "\n";
}
} else {
resultStr = "Scan was canceled.";
}
resultTextView.setText(resultStr);

}
}
}

28 changes: 14 additions & 14 deletions SampleApp/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp">

<Button
android:id="@+id/scanButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan a credit card with card.io"
android:onClick="onScanPress" />
android:id="@+id/scanButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan a credit card with card.io"
android:onClick="onScanPress"/>

<TextView
android:id="@+id/resultTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.95"
android:text="" />
android:id="@+id/resultTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.95"
android:text=""/>

</LinearLayout>
7 changes: 7 additions & 0 deletions SampleApp/src/main/res/values-v11/style.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="android:Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
Binary file renamed aars/card.io-4.0.1.aar → aars/card.io-4.0.2.aar
Binary file not shown.
5 changes: 5 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
card.io Android SDK change log and release notes
================================================

4.0.2
-----
* Fix crash caused when an application's theme specifies no action bar [#44](https://github.com/card-io/card.io-Android-SDK/issues/44)).
* Use the application theme to define most of the UI's colors.

4.0.1
-----
* Minor bug fixes.
Expand Down

0 comments on commit 9c61c41

Please sign in to comment.