Skip to content

Commit b9636b7

Browse files
committed
Sample project.
1 parent 90b5656 commit b9636b7

File tree

17 files changed

+417
-0
lines changed

17 files changed

+417
-0
lines changed

app/app.iml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="CheckoutFlow" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android-gradle" name="Android-Gradle">
5+
<configuration>
6+
<option name="GRADLE_PROJECT_PATH" value=":app" />
7+
</configuration>
8+
</facet>
9+
<facet type="android" name="Android">
10+
<configuration>
11+
<option name="SELECTED_BUILD_VARIANT" value="debug" />
12+
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
13+
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
14+
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
15+
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16+
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
17+
<afterSyncTasks>
18+
<task>generateDebugAndroidTestSources</task>
19+
<task>generateDebugSources</task>
20+
</afterSyncTasks>
21+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
22+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
23+
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
24+
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
25+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
26+
</configuration>
27+
</facet>
28+
</component>
29+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
30+
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
31+
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
32+
<exclude-output />
33+
<content url="file://$MODULE_DIR$">
34+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
36+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
38+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
39+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
40+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
41+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
42+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
43+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
44+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
45+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
46+
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
59+
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
60+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
61+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
62+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
63+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
64+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
65+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
66+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
67+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
68+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
69+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
70+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
71+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
72+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
78+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
81+
</content>
82+
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
83+
<orderEntry type="sourceFolder" forTests="false" />
84+
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
85+
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
86+
<orderEntry type="module" module-name="creditcarddesign" exported="" />
87+
</component>
88+
</module>

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "22.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.cooltechworks.checkoutflow"
9+
minSdkVersion 10
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(include: ['*.jar'], dir: 'libs')
24+
compile project(':creditcarddesign')
25+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/sharish/ADT_BASE/adt-bundle-mac-x86_64-20130729/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.cooltechworks.checkoutflow">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme">
10+
<activity
11+
android:name="com.cooltechworks.creditcarddesign.CardEditActivity"
12+
android:configChanges="keyboard|keyboardHidden"
13+
android:label="@string/app_name">
14+
</activity>
15+
<activity
16+
android:name="com.cooltechworks.creditcarddesign.sample.MainActivity"
17+
android:label="@string/title_activity_main"
18+
android:theme="@style/AppTheme">
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
27+
</manifest>

app/src/main/assets/ocraextended.ttf

46.9 KB
Binary file not shown.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.cooltechworks.creditcarddesign.sample;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.v7.app.AppCompatActivity;
6+
import android.view.View;
7+
import android.widget.LinearLayout;
8+
9+
import com.cooltechworks.checkoutflow.R;
10+
import com.cooltechworks.creditcarddesign.CardEditActivity;
11+
import com.cooltechworks.creditcarddesign.CreditCardUtils;
12+
import com.cooltechworks.creditcarddesign.CreditCardView;
13+
14+
public class MainActivity extends AppCompatActivity {
15+
16+
17+
@Override
18+
protected void onCreate(Bundle savedInstanceState) {
19+
super.onCreate(savedInstanceState);
20+
setContentView(R.layout.activity_main);
21+
22+
23+
findViewById(R.id.add_card).setOnClickListener(new View.OnClickListener() {
24+
@Override
25+
public void onClick(View v) {
26+
Intent intent = new Intent(MainActivity.this, CardEditActivity.class);
27+
startActivityForResult(intent, 0);
28+
}
29+
});
30+
}
31+
32+
private void initListener(final int index, CreditCardView creditCardView) {
33+
34+
35+
creditCardView.setOnClickListener(new View.OnClickListener() {
36+
@Override
37+
public void onClick(View v) {
38+
39+
CreditCardView creditCardView = (CreditCardView) v;
40+
String cardNumber = creditCardView.getCardNumber();
41+
String expiry = creditCardView.getExpiry();
42+
String cardHolderName = creditCardView.getCardHolderName();
43+
44+
Intent intent = new Intent(MainActivity.this, CardEditActivity.class);
45+
intent.putExtra(CreditCardUtils.EXTRA_CARD_HOLDER_NAME, cardHolderName);
46+
intent.putExtra(CreditCardUtils.EXTRA_CARD_NUMBER, cardNumber);
47+
intent.putExtra(CreditCardUtils.EXTRA_CARD_EXPIRY, expiry);
48+
intent.putExtra(CreditCardUtils.EXTRA_CARD_SHOW_CARD_SIDE, CreditCardUtils.CARD_SIDE_FRONT);
49+
50+
startActivityForResult(intent, index);
51+
52+
}
53+
});
54+
55+
}
56+
57+
58+
59+
public void onActivityResult(int reqCode, int resultCode, Intent data) {
60+
61+
if(resultCode == RESULT_OK) {
62+
63+
LinearLayout cardContainer = (LinearLayout) findViewById(R.id.card_container);
64+
65+
66+
String name = data.getStringExtra(CreditCardUtils.EXTRA_CARD_HOLDER_NAME);
67+
String cardNumber = data.getStringExtra(CreditCardUtils.EXTRA_CARD_NUMBER);
68+
String expiry = data.getStringExtra(CreditCardUtils.EXTRA_CARD_EXPIRY);
69+
String cvv = data.getStringExtra(CreditCardUtils.EXTRA_CARD_CVV);
70+
71+
72+
if(reqCode == 0) {
73+
74+
75+
CreditCardView creditCardView = new CreditCardView(this);
76+
77+
creditCardView.setCVV(cvv);
78+
creditCardView.setCardHolderName(name);
79+
creditCardView.setCardExpiry(expiry);
80+
creditCardView.setCardNumber(cardNumber);
81+
82+
int index = cardContainer.getChildCount();
83+
cardContainer.addView(creditCardView);
84+
initListener(index, creditCardView);
85+
86+
87+
88+
}
89+
else {
90+
91+
CreditCardView creditCardView = (CreditCardView) cardContainer.getChildAt(reqCode);
92+
93+
creditCardView.setCardExpiry(expiry);
94+
creditCardView.setCardNumber(cardNumber);
95+
creditCardView.setCardHolderName(name);
96+
creditCardView.setCVV(cvv);
97+
98+
}
99+
}
100+
101+
102+
}
103+
104+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
android:layout_width="wrap_content"
6+
android:layout_gravity="center"
7+
android:layout_height="match_parent"
8+
tools:context="com.cooltechworks.creditcarddesign.sample.MainActivity">
9+
10+
<LinearLayout
11+
android:id="@+id/card_container"
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
android:orientation="vertical"
15+
>
16+
17+
<!--<com.cooltechworks.creditcarddesign.CreditCardView-->
18+
<!--android:id="@+id/card_1"-->
19+
<!--android:layout_width="wrap_content"-->
20+
<!--android:layout_height="wrap_content"-->
21+
<!--app:card_number="56656789000000000"-->
22+
<!--app:card_holder_name="JOHN MATTEW"-->
23+
<!--app:cvv="522"-->
24+
<!--app:card_expiration="01/12"-->
25+
<!--/>-->
26+
27+
<!--<com.cooltechworks.creditcarddesign.CreditCardView-->
28+
<!--android:id="@+id/card_2"-->
29+
<!--android:layout_width="wrap_content"-->
30+
<!--android:layout_height="wrap_content"-->
31+
<!--app:card_number="34656789000000000"-->
32+
<!--app:card_holder_name="JOHN MATTEW"-->
33+
<!--app:cvv="522"-->
34+
<!--app:card_expiration="01/12"-->
35+
<!--/>-->
36+
37+
<!--<com.cooltechworks.creditcarddesign.CreditCardView-->
38+
<!--android:id="@+id/card_3"-->
39+
<!--android:layout_width="wrap_content"-->
40+
<!--android:layout_height="wrap_content"-->
41+
<!--app:card_number="44656789000000000"-->
42+
<!--app:card_holder_name="JOHN MATTEW"-->
43+
<!--app:cvv="522"-->
44+
<!--app:card_expiration="01/12"-->
45+
<!--/>-->
46+
47+
48+
<!--<com.cooltechworks.creditcarddesign.CreditCardView-->
49+
<!--android:id="@+id/card_4"-->
50+
<!--android:layout_width="wrap_content"-->
51+
<!--android:layout_height="wrap_content"-->
52+
<!--app:card_number="56456789000000000"-->
53+
<!--app:card_holder_name="JOHN MATTEW"-->
54+
<!--app:cvv="522"-->
55+
<!--app:card_expiration="01/12"-->
56+
<!--/>-->
57+
58+
<!--<com.cooltechworks.creditcarddesign.CreditCardView-->
59+
<!--android:id="@+id/card_5"-->
60+
<!--android:layout_width="wrap_content"-->
61+
<!--android:layout_height="wrap_content"-->
62+
<!--app:card_number="38056789000000000"-->
63+
<!--app:card_holder_name="JOHN MATTEW"-->
64+
<!--app:cvv="522"-->
65+
<!--app:card_expiration="01/12"-->
66+
<!--/>-->
67+
68+
<Button
69+
android:id="@+id/add_card"
70+
android:layout_width="match_parent"
71+
android:layout_height="wrap_content"
72+
android:text="ADD CARD"
73+
/>
74+
75+
</LinearLayout>
76+
77+
</ScrollView>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading

0 commit comments

Comments
 (0)