Skip to content

Commit

Permalink
Updating Version and how filled is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinSchildhorn committed Oct 6, 2020
1 parent 63b9cf9 commit d6bc791
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.kevinschildhorn.otpview.sample"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionCode 14
versionName "1.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
6 changes: 3 additions & 3 deletions otpView/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ android {
}

defaultConfig {
minSdkVersion 26
minSdkVersion 15
targetSdkVersion 29
versionCode 10
versionName "0.1.3"
versionCode 14
versionName "0.1.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
10 changes: 8 additions & 2 deletions otpView/src/main/java/com/kevinschildhorn/otpview/OTPView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ import android.view.Gravity
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.View.OnKeyListener
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.Toast
import androidx.core.widget.addTextChangedListener
import com.kevinschildhorn.otpview.otpview.R
import kotlinx.android.synthetic.main.otp_view_layout.view.*
Expand Down Expand Up @@ -179,6 +181,11 @@ class OTPView @JvmOverloads constructor(
editTexts[index-1].setText("")
disableEditListener = false
}
if (event.action == KeyEvent.ACTION_DOWN &&
keyCode == KeyEvent.KEYCODE_ENTER) {
if(isEverythingFilled())
onFinishFunction(getStringFromFields())
}
return@setOnKeyListener false
}
editTexts[index].setOnFocusChangeListener { v, hasFocus ->
Expand All @@ -190,6 +197,7 @@ class OTPView @JvmOverloads constructor(
editTexts[focusIndex].setSelection(0)
})
}

if(isPassword) {
editTexts.forEach {
it.transformationMethod =
Expand All @@ -205,8 +213,6 @@ class OTPView @JvmOverloads constructor(
focusIndex < 0 -> focusIndex = 0
focusIndex < editTexts.size -> {
editTexts[focusIndex].requestFocus()
if(isEverythingFilled())
onFinishFunction(getStringFromFields())
}
else -> {
editTexts.forEach {
Expand Down

0 comments on commit d6bc791

Please sign in to comment.