Skip to content

Commit

Permalink
fixed runtime error. Close #4
Browse files Browse the repository at this point in the history
  • Loading branch information
fevziomurtekin committed Jun 18, 2020
1 parent b4f0067 commit c436927
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 17 deletions.
109 changes: 109 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions payview/src/main/java/com/fevziomurtekin/payview/Payview.kt
Original file line number Diff line number Diff line change
Expand Up @@ -382,22 +382,24 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
private fun checkCardType(cardNo: String?){
when(cardNo?.substring(0,1).toString().toInt()){
3->{
when(cardNo?.substring(0,2)?.toInt()){
in 30..38->{
cardType = CardType.DINNERSCLUB
iv_card_type.setImageResource(R.drawable.ic_dinners)
}
35->{
cardType = CardType.JCB
iv_card_type.setImageResource(R.drawable.ic_jcb)
}
37->{
cardType = CardType.AMERICANEXPRESS
iv_card_type.setImageResource(R.drawable.ic_american_express)
}
else->{
cardType = CardType.UNDEFINED
iv_card_type.setImageResource(R.drawable.ic_warning)
if(cardNo?.length!! > 2) {
when (cardNo?.substring(0, 2)?.toInt()) {
in 30..38 -> {
cardType = CardType.DINNERSCLUB
iv_card_type.setImageResource(R.drawable.ic_dinners)
}
35 -> {
cardType = CardType.JCB
iv_card_type.setImageResource(R.drawable.ic_jcb)
}
37 -> {
cardType = CardType.AMERICANEXPRESS
iv_card_type.setImageResource(R.drawable.ic_american_express)
}
else -> {
cardType = CardType.UNDEFINED
iv_card_type.setImageResource(R.drawable.ic_warning)
}
}
}
}
Expand Down

0 comments on commit c436927

Please sign in to comment.