Skip to content

Commit 146ff03

Browse files
committed
convert to kotlin
1 parent 6ea1c15 commit 146ff03

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
android:layout_width="wrap_content"
1919
android:layout_height="16dp" />
2020

21-
<Space
22-
android:layout_width="wrap_content"
23-
android:layout_height="16dp" />
24-
25-
<Space
26-
android:layout_width="wrap_content"
27-
android:layout_height="16dp" />
28-
29-
<Space
30-
android:layout_width="wrap_content"
31-
android:layout_height="16dp" />
3221

3322
<View
3423
android:layout_width="match_parent"
@@ -89,19 +78,30 @@
8978
app:inputType="Integer"
9079
app:numberOfBlock="@{numberOfBlock_id, default=4}"
9180
app:text="@{id_number}" />
81+
<Space
82+
android:layout_width="wrap_content"
83+
android:layout_height="16dp" />
84+
85+
86+
<View
87+
android:layout_width="match_parent"
88+
android:layout_height="1px"
89+
android:layout_marginBottom="8dp"
90+
android:layout_marginTop="16dp"
91+
android:background="#aaa" />
9292

9393
<com.infideap.blockedittext.BlockEditText
9494
android:id="@+id/blockEditText_unshift_position"
9595
android:layout_width="match_parent"
9696
android:layout_height="wrap_content"
97-
app:bet_cardIconSize="48dp"
98-
app:bet_cardPrefix="Mastercard|Visa"
99-
app:bet_defaultLength="4"
100-
app:bet_editTextBackground="@drawable/selector_edittext_round_border"
101-
app:bet_hint="Unshift Block"
102-
app:bet_inputType="Integer"
103-
app:bet_numberOfBlock="4"
104-
app:bet_shiftPosition="false" />
97+
app:cardIconSize="48dp"
98+
app:cardPrefix="Mastercard|Visa"
99+
app:defaultLength="4"
100+
app:editTextBackground="@drawable/selector_edittext_round_border"
101+
app:hint="Unshift Block"
102+
app:inputType="Integer"
103+
app:numberOfBlock="4"
104+
app:shiftPosition="false" />
105105
</LinearLayout>
106106

107107

blockedittext/src/main/java/com/infideap/blockedittext/BlockEditText.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ class BlockEditText : FrameLayout {
136136
inputType
137137
)
138138
shiftPosition = a.getBoolean(
139-
R.styleable.BlockEditText_bet_showCardIcon,
139+
R.styleable.BlockEditText_showCardIcon,
140140
true
141141
)
142142
isShowCardIcon = a.getBoolean(
143143
R.styleable.BlockEditText_showCardIcon,
144144
true
145145
)
146146
editTextStyle = a.getResourceId(
147-
R.styleable.BlockEditText_bet_style, -1
147+
R.styleable.BlockEditText_style, -1
148148
)
149149
val cardPrefix = a.getInt(
150150
R.styleable.BlockEditText_cardPrefix,
@@ -161,7 +161,7 @@ class BlockEditText : FrameLayout {
161161
}
162162
setHintTextAppearance(hintTextAppearance)
163163
shiftPosition = a.getBoolean(
164-
R.styleable.BlockEditText_bet_shiftPosition,
164+
R.styleable.BlockEditText_shiftPosition,
165165
true
166166
)
167167
initLayout()
@@ -383,8 +383,8 @@ class BlockEditText : FrameLayout {
383383
}
384384
}
385385

386-
private fun setEdiTextBackground(editText: AEditText?, drawable: Drawable) {
387-
ViewCompat.setBackground(editText!!, drawable.constantState!!.newDrawable())
386+
private fun setEdiTextBackground(editText: AEditText?, drawable: Drawable?) {
387+
ViewCompat.setBackground(editText!!, drawable?.constantState?.newDrawable())
388388
}
389389

390390
fun setLengthAt(index: Int, length: Int) {

0 commit comments

Comments
 (0)