diff --git a/app/app.iml b/app/app.iml
deleted file mode 100644
index c25f225..0000000
--- a/app/app.iml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugAndroidTestSources
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 707a743..aa47cfb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,17 +1,20 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.1"
+ compileSdkVersion 28
defaultConfig {
- vectorDrawables.useSupportLibrary = true
- applicationId "com.cooltechworks.checkoutflow"
- minSdkVersion 10
- targetSdkVersion 25
+ minSdkVersion 16
+ targetSdkVersion 28
+
versionCode 2
versionName "1.1"
+
+ applicationId "com.cooltechworks.checkoutflow"
+
+ vectorDrawables.useSupportLibrary = true
}
+
buildTypes {
release {
minifyEnabled false
@@ -21,6 +24,6 @@ android {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile project(':creditcarddesign')
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation project(':creditcarddesign')
}
diff --git a/app/build/intermediates/transforms/instantRunSlicer/debug/folders/1/5/slice_1/buildId.txt b/app/build/intermediates/transforms/instantRunSlicer/debug/folders/1/5/slice_1/buildId.txt
deleted file mode 100644
index 9851264..0000000
--- a/app/build/intermediates/transforms/instantRunSlicer/debug/folders/1/5/slice_1/buildId.txt
+++ /dev/null
@@ -1 +0,0 @@
-341292733940663
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 66df64d..9fcf92b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+
repositories {
+ google()
jcenter()
}
+
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.2'
+ classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -14,6 +17,7 @@ buildscript {
allprojects {
repositories {
+ google()
jcenter()
maven{
url "https://jitpack.io"
diff --git a/creditcarddesign/build.gradle b/creditcarddesign/build.gradle
index e70c8f3..5308bdf 100644
--- a/creditcarddesign/build.gradle
+++ b/creditcarddesign/build.gradle
@@ -2,14 +2,16 @@ apply plugin: 'com.android.library'
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.1"
+ compileSdkVersion 28
+
defaultConfig {
- vectorDrawables.useSupportLibrary = true
- minSdkVersion 10
- targetSdkVersion 25
+ minSdkVersion 16
+ targetSdkVersion 28
+
versionCode 1
versionName "1.0.3"
+
+ vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
@@ -20,9 +22,10 @@ android {
}
dependencies {
- final SUPPORT_VERSION = "25.0.1"
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile "com.android.support:appcompat-v7:$SUPPORT_VERSION"
- compile "com.android.support:cardview-v7:$SUPPORT_VERSION"
- compile 'com.github.ozodrukh:CircularReveal:1.0.5'
+ api fileTree(dir: 'libs', include: ['*.jar'])
+ api "com.android.support:appcompat-v7:28.0.0"
+ api "com.android.support:cardview-v7:28.0.0"
+ api('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
+ transitive = true
+ }
}
diff --git a/creditcarddesign/creditcarddesign.iml b/creditcarddesign/creditcarddesign.iml
deleted file mode 100644
index c97c699..0000000
--- a/creditcarddesign/creditcarddesign.iml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugAndroidTestSources
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardUtils.java b/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardUtils.java
index 030d991..92eb62f 100755
--- a/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardUtils.java
+++ b/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardUtils.java
@@ -46,6 +46,11 @@ public static String handleCardNumber(String inputCardNumber) {
return handleCardNumber(inputCardNumber,SPACE_SEPERATOR);
}
+ public static String handleCardNumber(String inputCardNumber, CardType cardType) {
+
+ return handleCardNumber(inputCardNumber, SPACE_SEPERATOR, cardType);
+ }
+
public static CardType selectCardType(String cardNumber) {
Pattern pCardType = Pattern.compile(PATTERN_VISA);
if(pCardType.matcher(cardNumber).matches())
@@ -67,8 +72,11 @@ public static int selectCardLength(CardType cardType) {
}
public static String handleCardNumber(String inputCardNumber, String seperator) {
+ return handleCardNumber(inputCardNumber, seperator, selectCardType(inputCardNumber));
+ }
+
+ public static String handleCardNumber(String inputCardNumber, String seperator, CardType cardType) {
String unformattedText = inputCardNumber.replace(seperator, "");
- CardType cardType = selectCardType(inputCardNumber);
String format = (cardType == CardType.AMEX_CARD) ? CARD_NUMBER_FORMAT_AMEX : CARD_NUMBER_FORMAT;
StringBuilder sbFormattedNumber = new StringBuilder();
for(int iIdx = 0, jIdx = 0; (iIdx < format.length()) && (unformattedText.length() > jIdx); iIdx++) {
@@ -82,8 +90,11 @@ public static String handleCardNumber(String inputCardNumber, String seperator)
}
public static String formatCardNumber(String inputCardNumber, String seperator) {
+ return formatCardNumber(inputCardNumber, seperator, selectCardType(inputCardNumber));
+ }
+
+ public static String formatCardNumber(String inputCardNumber, String seperator, CardType cardType) {
String unformattedText = inputCardNumber.replace(seperator, "");
- CardType cardType = selectCardType(inputCardNumber);
String format = (cardType == CardType.AMEX_CARD) ? CARD_NUMBER_FORMAT_AMEX : CARD_NUMBER_FORMAT;
StringBuilder sbFormattedNumber = new StringBuilder();
for(int iIdx = 0, jIdx = 0; iIdx < format.length(); iIdx++) {
diff --git a/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardView.java b/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardView.java
index ad4cb0a..3542c74 100644
--- a/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardView.java
+++ b/creditcarddesign/src/main/java/com/cooltechworks/creditcarddesign/CreditCardView.java
@@ -15,7 +15,6 @@
import android.widget.ImageView;
import android.widget.TextView;
-import io.codetail.animation.SupportAnimator;
import io.codetail.animation.ViewAnimationUtils;
/**
@@ -44,6 +43,7 @@ public class CreditCardView extends FrameLayout {
private boolean changeCardColor;
private boolean showCardAnimation;
+ private boolean forcedCardType;
int mCardnameLen;
@@ -74,12 +74,14 @@ public String getExpiry() {
return mExpiry;
}
- public CreditCardUtils.CardType getCardType() { return mCardType; }
+ public CreditCardUtils.CardType getCardType() {
+ return mCardType;
+ }
- interface ICustomCardSelector {
+ public interface ICustomCardSelector {
CardSelector getCardSelector(String cardNumber);
}
-
+
private void init() {
mCurrentDrawable = R.drawable.card_color_round_rect_default;
@@ -106,22 +108,22 @@ private void init(AttributeSet attrs) {
changeCardColor = a.getBoolean(R.styleable.creditcard_change_card_color, true);
showCardAnimation = a.getBoolean(R.styleable.creditcard_show_card_animation, true);
boolean showChipOnCard = a.getBoolean(R.styleable.creditcard_show_chip_on_card, true);
- if(!showChipOnCard) {
+ if (!showChipOnCard) {
View chipContainer = findViewById(R.id.chip_container);
- if(chipContainer != null) {
+ if (chipContainer != null) {
chipContainer.setVisibility(View.INVISIBLE);
}
}
int cvv = a.getInt(R.styleable.creditcard_cvv, 0);
- int cardSide = a.getInt(R.styleable.creditcard_card_side,CreditCardUtils.CARD_SIDE_FRONT);
+ int cardSide = a.getInt(R.styleable.creditcard_card_side, CreditCardUtils.CARD_SIDE_FRONT);
setCardNumber(cardNumber);
setCVV(cvv);
setCardExpiry(expiry);
setCardHolderName(cardHolderName);
- if(cardSide == CreditCardUtils.CARD_SIDE_BACK) {
+ if (cardSide == CreditCardUtils.CARD_SIDE_BACK) {
showBackImmediate();
}
@@ -143,14 +145,13 @@ private void flip(final boolean ltr, boolean isImmediate) {
View layoutContentContainer = findViewById(R.id.card_container);
- if(isImmediate) {
- frontContentView.setVisibility(ltr?VISIBLE:GONE);
- backContentView.setVisibility(ltr?GONE:VISIBLE);
+ if (isImmediate) {
+ frontContentView.setVisibility(ltr ? VISIBLE : GONE);
+ backContentView.setVisibility(ltr ? GONE : VISIBLE);
- }
- else {
+ } else {
- int duration = 600;
+ int duration = 600;
FlipAnimator flipAnimator = new FlipAnimator(frontView, backView, frontView.getWidth() / 2, backView.getHeight() / 2);
flipAnimator.setInterpolator(new OvershootInterpolator(0.5f));
@@ -180,25 +181,31 @@ private void flip(final boolean ltr, boolean isImmediate) {
}
+ public void setCardType(CreditCardUtils.CardType cardType) {
+ forcedCardType = cardType != null;
+ mCardType = cardType;
+ }
+
public void setCardNumber(String rawCardNumber) {
this.mRawCardNumber = rawCardNumber == null ? "" : rawCardNumber;
- this.mCardType = CreditCardUtils.selectCardType(this.mRawCardNumber);
- String cardNumber = CreditCardUtils.formatCardNumber(this.mRawCardNumber, CreditCardUtils.SPACE_SEPERATOR);
+ if (!forcedCardType) {
+ this.mCardType = CreditCardUtils.selectCardType(this.mRawCardNumber);
+ }
+ String cardNumber = CreditCardUtils.formatCardNumber(this.mRawCardNumber, CreditCardUtils.SPACE_SEPERATOR, mCardType);
- ((TextView)findViewById(TEXTVIEW_CARD_NUMBER_ID)).setText(cardNumber);
- ((TextView)findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setVisibility(mCardType == CreditCardUtils.CardType.AMEX_CARD ? View.VISIBLE : View.GONE);
+ ((TextView) findViewById(TEXTVIEW_CARD_NUMBER_ID)).setText(cardNumber);
+ ((TextView) findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setVisibility(mCardType == CreditCardUtils.CardType.AMEX_CARD ? View.VISIBLE : View.GONE);
- if(this.mCardType != CreditCardUtils.CardType.UNKNOWN_CARD) {
+ if (this.mCardType != CreditCardUtils.CardType.UNKNOWN_CARD) {
this.post(new Runnable() {
@Override
public void run() {
revealCardAnimation();
}
});
- }
- else {
+ } else {
paintCard();
}
@@ -206,10 +213,9 @@ public void run() {
public void setCVV(int cvvInt) {
- if(cvvInt == 0) {
+ if (cvvInt == 0) {
setCVV("");
- }
- else {
+ } else {
String cvv = String.valueOf(cvvInt);
setCVV(cvv);
}
@@ -217,34 +223,34 @@ public void setCVV(int cvvInt) {
}
public void showFront() {
- flip(true,false);
+ flip(true, false);
}
public void showFrontImmediate() {
- flip(true,true);
+ flip(true, true);
}
public void showBack() {
- flip(false,false);
+ flip(false, false);
}
public void showBackImmediate() {
- flip(false,true);
+ flip(false, true);
}
public void setCVV(String cvv) {
- if(cvv == null) {
+ if (cvv == null) {
cvv = "";
}
this.mCVV = cvv;
- ((TextView)findViewById(TEXTVIEW_CARD_CVV_ID)).setText(cvv);
- ((TextView)findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setText(cvv);
+ ((TextView) findViewById(TEXTVIEW_CARD_CVV_ID)).setText(cvv);
+ ((TextView) findViewById(TEXTVIEW_CARD_CVV_AMEX_ID)).setText(cvv);
}
public void setCardExpiry(String dateYear) {
- dateYear = dateYear == null ? "": CreditCardUtils.handleExpiration(dateYear);
+ dateYear = dateYear == null ? "" : CreditCardUtils.handleExpiration(dateYear);
this.mExpiry = dateYear;
@@ -256,13 +262,13 @@ public void setCardExpiry(String dateYear) {
public void setCardHolderName(String cardHolderName) {
cardHolderName = cardHolderName == null ? "" : cardHolderName;
- if(cardHolderName.length() > mCardnameLen) {
- cardHolderName = cardHolderName.substring(0,mCardnameLen);
+ if (cardHolderName.length() > mCardnameLen) {
+ cardHolderName = cardHolderName.substring(0, mCardnameLen);
}
this.mCardHolderName = cardHolderName;
- ((TextView)findViewById(TEXTVIEW_CARD_HOLDER_ID)).setText(cardHolderName);
+ ((TextView) findViewById(TEXTVIEW_CARD_HOLDER_ID)).setText(cardHolderName);
}
public void paintCard() {
@@ -274,7 +280,7 @@ public void paintCard() {
View chipContainer = findViewById(R.id.chip_container);
View chipInner = findViewById(R.id.chip_inner_view);
- View cardBack = findViewById(BACK_CARD_OUTLINE_ID);
+ View cardBack = findViewById(BACK_CARD_OUTLINE_ID);
View cardFront = findViewById(FRONT_CARD_OUTLINE_ID);
@@ -291,7 +297,7 @@ public void paintCard() {
ImageView backLogoImageView = (ImageView) findViewById(BACK_CARD_ID).findViewById(R.id.logo_img);
backLogoImageView.setImageResource(card.getResLogoId());
- if(changeCardColor) {
+ if (changeCardColor) {
cardBack.setBackgroundResource(card.getResCardId());
cardFront.setBackgroundResource(card.getResCardId());
}
@@ -307,14 +313,16 @@ public void revealCardAnimation() {
paintCard();
- if(showCardAnimation && changeCardColor) {
+ if (showCardAnimation && changeCardColor) {
animateChange(cardContainer, cardFront, card.getResCardId());
}
}
public CardSelector selectCard() {
- if(mSelectorLogic != null) {
+ if (mSelectorLogic != null) {
return mSelectorLogic.getCardSelector(mRawCardNumber);
+ } else if (forcedCardType) {
+ return CardSelector.selectCardType(mCardType);
}
return CardSelector.selectCard(mRawCardNumber);
}
@@ -341,7 +349,7 @@ public void showAnimation(final View cardContainer, final View v, final int draw
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
- SupportAnimator animator =
+ Animator animator =
ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(duration);
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 04e285f..17de8c5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Mon Aug 12 14:01:18 EEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/local.properties b/local.properties
deleted file mode 100644
index f53e644..0000000
--- a/local.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-## This file is automatically generated by Android Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# Location of the SDK. This is only used by Gradle.
-# For customization when using a Version Control System, please read the
-# header note.
-#Sat Dec 26 14:43:24 IST 2015
-sdk.dir=/Users/Harish/Android_SDK/android-sdk-macosx