Skip to content

Commit

Permalink
Updating some margin issues
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinSchildhorn committed Sep 22, 2020
1 parent 1ffcedf commit ade7f58
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ allprojects {
}
dependencies {
implementation 'com.github.KevinSchildhorn:OTPView:0.1.2'
implementation 'com.github.KevinSchildhorn:OTPView:0.1.3'
}
```

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textCapCharacters"
app:otp_itemCount="4"
app:otp_itemCount="6"
app:otp_showCursor="true"
app:otp_textSize="24sp"
app:otp_highlightedTextSize="24sp"
Expand Down
4 changes: 2 additions & 2 deletions otpView/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
minSdkVersion 26
targetSdkVersion 29
versionCode 10
versionName "0.1.2"
versionName "0.1.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -40,7 +40,7 @@ afterEvaluate {
release(MavenPublication) {
from components.release
groupId = 'com.kevinschildhorn.otpview'
version = '0.1.2'
version = '0.1.3'
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions otpView/src/main/java/com/kevinschildhorn/otpview/OTPView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class OTPView @JvmOverloads constructor(

private fun initEditTexts(){
for(x in 0 until itemCount){
addEditText()
addEditText(x)
addListenerForIndex(x)
}

Expand Down Expand Up @@ -213,7 +213,7 @@ class OTPView @JvmOverloads constructor(
styleEditTexts()
}

private fun addEditText(){
private fun addEditText(index:Int){
val et = EditText(context)

// All
Expand All @@ -226,8 +226,11 @@ class OTPView @JvmOverloads constructor(
)

et.isAllCaps = allCaps

val leftDp = if(index == 0) 8.dpTopx else 0.dpTopx

params.setMargins(
0,
leftDp,
8.dpTopx,
marginBetween,
8.dpTopx
Expand Down

0 comments on commit ade7f58

Please sign in to comment.