diff --git a/.idea/StickySelectionHighlights.xml b/.idea/StickySelectionHighlights.xml
new file mode 100644
index 0000000..035f5e2
--- /dev/null
+++ b/.idea/StickySelectionHighlights.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index b5c34ba..6178c85 100644
--- a/README.md
+++ b/README.md
@@ -41,26 +41,32 @@ dependencies {
## Layout
```xml
-
+
```
## Listeners
@@ -101,6 +107,12 @@ dependencies {
|`cardMonthErrorText`|Default text ""You must enter 2-digit characters and you'll enter to number the most digit-value is '12'"|
|`cardYearErrorText`| Default text "You must enter 2-digit characters and you'll enter to number the most digit-value is '99'"|
|`cardExpiredErrorText`| Default text "Your card has expired. Please enter the usage date correctly."|
+|`cardBtnPayText`| Default text "Pay"|
+|`cardNameHintText`| Default text "Card Name"|
+|`cardNoHintText`| Default text "Card No"|
+|`cardMonthHintText`| Default text "Month"|
+|`cardYearHintText`| Default text "Year"|
+|`cardCvHintText`| Default text "Cv Code"|
## License
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3705478..e55ca34 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -20,6 +20,12 @@
app:cardNameTextSize="15"
app:cardMonthTextSize="13"
app:cardAnimationType="vertical"
+ app:cardBtnPayText="Proceed to pay"
+ app:cardNameHintText="Name on card"
+ app:cardNoHintText="Card Number"
+ app:cardMonthHintText="MM"
+ app:cardYearHintText="YY"
+ app:cardCvHintText="CVV"
app:cardCvErrorText="You must enter 3-digit characters"
app:cardMonthErrorText="You must enter 2-digit characters and you'll enter to number the most digit-value is '12'"
app:cardYearErrorText="You must enter 2-digit characters and you'll enter to number the most digit-value is '99'"
diff --git a/build.gradle b/build.gradle
index 9d271a7..03ed29e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.3.40'
+ ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
+ classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index d269cab..ac1f915 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jun 28 22:43:33 EET 2019
+#Tue Jun 23 10:58:51 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/payview/build.gradle b/payview/build.gradle
index 63914e8..5ec797d 100644
--- a/payview/build.gradle
+++ b/payview/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
android {
- compileSdkVersion 28
+ compileSdkVersion 29
defaultConfig {
minSdkVersion 21
- targetSdkVersion 28
+ targetSdkVersion 29
versionCode 1
versionName "1.0"
@@ -28,11 +28,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
- implementation "androidx.core:core-ktx:1.0.2"
+ implementation "androidx.core:core-ktx:1.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.0.0'
}
diff --git a/payview/src/main/java/com/fevziomurtekin/payview/Payview.kt b/payview/src/main/java/com/fevziomurtekin/payview/Payview.kt
index e7ae901..1d7fb8a 100644
--- a/payview/src/main/java/com/fevziomurtekin/payview/Payview.kt
+++ b/payview/src/main/java/com/fevziomurtekin/payview/Payview.kt
@@ -50,6 +50,12 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
private var cardYearTextSize : Int = 13
private var cardMonthTextSize : Int = 13
private var cardCvTextSize : Int = 14
+ private var cardBtnPayText : String = resources.getString(R.string.pay)
+ private var cardNameHintText : String = resources.getString(R.string.cardname)
+ private var cardNoHintText : String = resources.getString(R.string.cardno)
+ private var cardMonthHintText : String = resources.getString(R.string.cardmonth)
+ private var cardYearHintText : String = resources.getString(R.string.cardyear)
+ private var cardCvHintText : String = resources.getString(R.string.cardcv)
/** Views on layout.*/
@@ -141,6 +147,18 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
cardYearTextSize=it.getInt(R.styleable.Payview_cardYearTextSize,13)
cardMonthTextSize=it.getInt(R.styleable.Payview_cardMonthTextSize,13)
cardCvTextSize=it.getInt(R.styleable.Payview_cardCvTextSize,14)
+ cardBtnPayText=it.getString(R.styleable.Payview_cardBtnPayText).let { s-> s?.toString()
+ ?: cardBtnPayText }
+ cardNameHintText=it.getString(R.styleable.Payview_cardNameHintText).let { s-> s?.toString()
+ ?: cardNameHintText }
+ cardNoHintText=it.getString(R.styleable.Payview_cardNoHintText).let { s-> s?.toString()
+ ?: cardNoHintText }
+ cardMonthHintText=it.getString(R.styleable.Payview_cardMonthHintText).let { s-> s?.toString()
+ ?: cardMonthHintText }
+ cardYearHintText=it.getString(R.styleable.Payview_cardYearHintText).let { s-> s?.toString()
+ ?: cardYearHintText }
+ cardCvHintText=it.getString(R.styleable.Payview_cardCvHintText).let { s-> s?.toString()
+ ?: cardCvHintText }
cardAnimationType=it.getInt(R.styleable.Payview_cardAnimationType,AnimationType.HORIZONTAL)
initViews()
initData()
@@ -223,6 +241,14 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
tev_card_year.textSize = cardYearTextSize.toFloat()
tev_card_month.textSize = cardMonthTextSize.toFloat()
tev_card_cv.textSize = cardCvTextSize.toFloat()
+ btn_pay.text = cardBtnPayText
+
+ // Custom Hint Text
+ til_card_name.hint = cardNameHintText
+ til_card_no.hint = cardNoHintText
+ til_card_month.hint = cardMonthHintText
+ til_card_year.hint = cardYearHintText
+ til_card_cv.hint = cardCvHintText
tev_card_name.onFocusChangeListener = this
tev_card_no.onFocusChangeListener = this
@@ -498,7 +524,7 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
&& tev_card_cv.text.toString().length==3
&& tev_card_month.text.toString().length==2
&& tev_card_year.text.toString().length==2
- && tev_card_no.text?.toString()?.replace(" ","")?.length==16){
+ && tev_card_no.text?.toString()?.replace(" ","")?.length in 14..16){
/** card month/card year compare to now date.*/
val nowMonth = Calendar.getInstance().get(Calendar.MONTH)
@@ -512,34 +538,50 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
}else true
}
else{
- if(tev_card_name.text.isNullOrEmpty())
+ var valid = true
+ if(tev_card_name.text.isNullOrEmpty()) {
tev_card_name.error = cardNameHelperText
- if(tev_card_no.text?.toString()?.replace(" ","")?.length!=16)
+ valid = false
+ }
+ if(tev_card_no.text?.toString()?.replace(" ","")?.length!=16) {
tev_card_no.error = cardNoHelperText
+ valid = false
+ }
if(tev_card_cv.text.isNullOrEmpty()
- || tev_card_cv.text.toString().length!=3)
+ || tev_card_cv.text.toString().length!=3) {
tev_card_cv.error = cardCvErrorText
+ valid = false
+ }
if(tev_card_year.text.isNullOrEmpty()
|| tev_card_year.text.toString().length!=2
- || tev_card_year.text.toString().toInt()>99)
+ || tev_card_year.text.toString().toInt()>99) {
tev_card_year.error = cardYearErrorText
+ valid = false
+ }
if(tev_card_month.text.isNullOrEmpty()
|| tev_card_month.text.toString().length!=2
- || tev_card_month.text.toString().toInt()<12)
+ || tev_card_month.text.toString().toInt()<12) {
tev_card_month.error = cardMonthErrorText
+ valid = false
+ }
- /** card month/card year compare to now date.*/
- val nowMonth = Calendar.getInstance().get(Calendar.MONTH)
- val nowYear = Calendar.getInstance().get(Calendar.YEAR).toString().substring(2,4).toInt()
- if(nowYear>tev_card_year.text.toString().toInt()
- || (nowYear==tev_card_year.text.toString().toInt()
- && nowMonth>=tev_card_month.text.toString().toInt())){
- tev_card_year.error = cardExpiredError
- tev_card_month.error = cardExpiredError
+ if (valid) {
+ /** card month/card year compare to now date.*/
+ val nowMonth = Calendar.getInstance().get(Calendar.MONTH)
+ val nowYear =
+ Calendar.getInstance().get(Calendar.YEAR).toString().substring(2, 4).toInt()
+ if (nowYear > tev_card_year.text.toString().toInt()
+ || (nowYear == tev_card_year.text.toString().toInt()
+ && nowMonth >= tev_card_month.text.toString().toInt())
+ ) {
+ tev_card_year.error = cardExpiredError
+ tev_card_month.error = cardExpiredError
+ valid = false
+ }
}
- return false
+ return valid
}
}
}
diff --git a/payview/src/main/res/layout/payview_layout.xml b/payview/src/main/res/layout/payview_layout.xml
index 788f8a4..fe4c2c1 100644
--- a/payview/src/main/res/layout/payview_layout.xml
+++ b/payview/src/main/res/layout/payview_layout.xml
@@ -82,8 +82,8 @@
android:id="@+id/lv_card_layout"
android:orientation="horizontal"
android:layout_above="@+id/iv_card_type"
- android:layout_marginLeft="40dp"
- android:layout_marginRight="40dp"
+ android:layout_marginLeft="35dp"
+ android:layout_marginRight="35dp"
android:layout_marginBottom="5dp"
>
+ app:counterEnabled="true"
+ app:counterTextAppearance="@style/CounterText">
+ app:counterEnabled="true"
+ app:counterTextAppearance="@style/CounterText">
+ app:counterEnabled="true"
+ app:counterTextAppearance="@style/CounterText">
+ app:counterEnabled="true"
+ app:counterTextAppearance="@style/CounterText">
+ app:counterEnabled="true"
+ app:counterTextAppearance="@style/CounterText">
+
+
+
+
+
+
diff --git a/payview/src/main/res/values/styles.xml b/payview/src/main/res/values/styles.xml
index b09c0d2..55b0418 100644
--- a/payview/src/main/res/values/styles.xml
+++ b/payview/src/main/res/values/styles.xml
@@ -3,4 +3,9 @@
+
+
\ No newline at end of file