Skip to content

Commit 3887220

Browse files
committed
Merge pull request #2 from zumper/master
Modernizing a bit
2 parents 8bf87e7 + ddf400b commit 3887220

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+941
-656
lines changed

.gitignore

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# built application files
2-
*.apk
3-
*.ap_
4-
5-
# files for the dex VM
6-
*.dex
7-
8-
# Java class files
9-
*.class
10-
11-
# generated files
12-
bin/
13-
gen/
1+
**/build/
2+
.idea/
143

154
# Local configuration file (sdk path, etc)
165
local.properties
6+
7+
# Android Studio
8+
*.iml
9+

CreditCardEntry/AndroidManifest.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
android:versionCode="1"
44
android:versionName="1.0" >
55

6-
<uses-sdk
7-
android:minSdkVersion="8"
8-
android:targetSdkVersion="17" />
9-
106
<application
117
android:allowBackup="true"
128
android:icon="@drawable/ic_launcher"

CreditCardEntry/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:1.1.0'
7+
}
8+
}
9+
apply plugin: 'com.android.library'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
android {
16+
compileSdkVersion 22
17+
buildToolsVersion '22.0.1'
18+
19+
defaultConfig {
20+
minSdkVersion 8
21+
targetSdkVersion 22
22+
}
23+
24+
sourceSets {
25+
main {
26+
assets.srcDirs = ['assets']
27+
res.srcDirs = ['res']
28+
aidl.srcDirs = ['src']
29+
resources.srcDirs = ['src']
30+
renderscript.srcDirs = ['src']
31+
java.srcDirs = ['src']
32+
manifest.srcFile 'AndroidManifest.xml'
33+
}
34+
}
35+
}
36+
37+
dependencies {
38+
compile 'com.android.support:support-v4:22.0.0'
39+
}
-377 KB
Binary file not shown.

CreditCardEntry/proguard-project.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

CreditCardEntry/project.properties

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:cycles="5" />
3+
android:cycles="2" />

CreditCardEntry/res/anim/shake.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<translate xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:duration="1000"
3+
android:duration="500"
44
android:fromXDelta="0%"
5-
android:interpolator="@anim/cycle_5"
6-
android:toXDelta="2%"
7-
android:toYDelta="2%" />
5+
android:interpolator="@anim/cycle"
6+
android:toXDelta="1%"
7+
android:toYDelta="1%" />
986 Bytes
476 Bytes
730 Bytes
897 Bytes
376 Bytes
939 Bytes
-1.51 KB
-1.42 KB
-1.21 KB
-1.32 KB
-420 Bytes
-1.25 KB
-5.28 KB
-4.12 KB
869 Bytes
-3.29 KB
-313 Bytes
-3.48 KB
2.04 KB
799 Bytes
1.62 KB
740 Bytes
1.91 KB

CreditCardEntry/res/drawable/background_grey.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3+
<stroke
4+
android:width="1dp"
5+
android:color="#000000"/>
6+
<solid
7+
android:color="#ffffff"
8+
/>
9+
<padding
10+
android:left="2dp"
11+
android:top="2dp"
12+
android:right="2dp"
13+
android:bottom="2dp" />
14+
</shape>

CreditCardEntry/res/layout/test.xml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme for API 21+. This theme completely replaces
5+
AppBaseTheme from BOTH res/values/styles.xml and
6+
res/values-v14/styles.xml on API 21+ devices.
7+
-->
8+
<style name="AppBaseTheme" parent="android:Theme.Material.Light">
9+
<!-- API 21 theme customizations can go here. -->
10+
</style>
11+
12+
</resources>

CreditCardEntry/res/values/attrs.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="CreditCardForm">
4+
<attr name="include_zip" format="boolean"/>
5+
<attr name="include_helper" format="boolean"/>
6+
<attr name="helper_text_color" format="color"/>
7+
</declare-styleable>
8+
</resources>

CreditCardEntry/res/values/colors.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<color name="stroke">#000</color>
44
<color name="grey_dark">#fff</color>
55
<color name="grey_light">#ddd</color>
6-
</resources>
6+
<color name="text_helper_color">#a8a8a8</color>
7+
<color name="text_helper_color2">#AA0</color>
8+
</resources>

CreditCardEntry/res/values/ids.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<item name="cc_layout" type="id">5555</item>
4+
</resources>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<resources>
22

33
<string name="app_name">CreditCardEntry</string>
4-
<string name="CreditCardNumberHelp">Enter credit or debit card number</string>
4+
<string name="CreditCardNumberHelp"/>
55
<string name="ExpirationDateHelp">Expiration date (MM/DD)</string>
6-
<string name="SecurityCodeHelp">Security code</string>
6+
<string name="SecurityCodeHelp">Security code (CVV)</string>
77
<string name="ZipHelp">Zip code of billing address</string>
88

99
</resources>

CreditCardEntry/src/com/devmarvel/creditcardentry/fields/CreditCardText.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
package com.devmarvel.creditcardentry.fields;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Context;
45
import android.text.Editable;
56
import android.util.AttributeSet;
6-
import android.util.Log;
77
import android.view.Gravity;
88

99
import com.devmarvel.creditcardentry.R;
10+
import com.devmarvel.creditcardentry.internal.CreditCardFieldDelegate;
1011
import com.devmarvel.creditcardentry.internal.CreditCardUtil;
1112
import com.devmarvel.creditcardentry.internal.CreditCardUtil.CardType;
12-
import com.devmarvel.creditcardentry.internal.CreditCardUtil.CreditCardFieldDelegate;
1313

1414
public class CreditCardText extends CreditEntryFieldBase {
15-
1615
private CardType type;
17-
private CreditCardFieldDelegate delegate;
18-
1916
private String previousNumber;
2017

2118
public CreditCardText(Context context) {
@@ -33,20 +30,22 @@ public CreditCardText(Context context, AttributeSet attrs, int defStyle) {
3330
init();
3431
}
3532

36-
public void init() {
33+
@SuppressLint("RtlHardcoded")
34+
@Override
35+
void init() {
3736
super.init();
3837
setGravity(Gravity.LEFT);
3938
setHint("1234 5678 9012 3456");
4039
}
4140

4241
/* TextWatcher Implementation Methods */
43-
public void beforeTextChanged(CharSequence s, int start, int count,
44-
int after) {
42+
@Override
43+
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
4544
previousNumber = s.toString();
4645
}
4746

47+
@Override
4848
public void afterTextChanged(Editable s) {
49-
5049
String number = s.toString();
5150

5251
if (number.length() >= CreditCardUtil.CC_LEN_FOR_TYPE) {
@@ -70,7 +69,6 @@ public void afterTextChanged(Editable s) {
7069
String formatted = CreditCardUtil.formatForViewing(number, type);
7170

7271
if (!number.equalsIgnoreCase(formatted)) {
73-
Log.i("CreditCardText", formatted);
7472
this.removeTextChangedListener(this);
7573
this.setText(formatted);
7674
this.setSelection(formatted.length());
@@ -96,15 +94,11 @@ public void afterTextChanged(Editable s) {
9694
}
9795
}
9896

97+
@Override
9998
public CreditCardFieldDelegate getDelegate() {
10099
return delegate;
101100
}
102101

103-
public void setDelegate(CreditCardFieldDelegate delegate) {
104-
this.delegate = delegate;
105-
delegate.focusOnField(this);
106-
}
107-
108102
public CardType getType() {
109103
return type;
110104
}

0 commit comments

Comments
 (0)