Skip to content

Commit

Permalink
convert to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
shiburagi committed Oct 6, 2020
1 parent 6ea1c15 commit 146ff03
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
38 changes: 19 additions & 19 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
android:layout_width="wrap_content"
android:layout_height="16dp" />

<Space
android:layout_width="wrap_content"
android:layout_height="16dp" />

<Space
android:layout_width="wrap_content"
android:layout_height="16dp" />

<Space
android:layout_width="wrap_content"
android:layout_height="16dp" />

<View
android:layout_width="match_parent"
Expand Down Expand Up @@ -89,19 +78,30 @@
app:inputType="Integer"
app:numberOfBlock="@{numberOfBlock_id, default=4}"
app:text="@{id_number}" />
<Space
android:layout_width="wrap_content"
android:layout_height="16dp" />


<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:background="#aaa" />

<com.infideap.blockedittext.BlockEditText
android:id="@+id/blockEditText_unshift_position"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:bet_cardIconSize="48dp"
app:bet_cardPrefix="Mastercard|Visa"
app:bet_defaultLength="4"
app:bet_editTextBackground="@drawable/selector_edittext_round_border"
app:bet_hint="Unshift Block"
app:bet_inputType="Integer"
app:bet_numberOfBlock="4"
app:bet_shiftPosition="false" />
app:cardIconSize="48dp"
app:cardPrefix="Mastercard|Visa"
app:defaultLength="4"
app:editTextBackground="@drawable/selector_edittext_round_border"
app:hint="Unshift Block"
app:inputType="Integer"
app:numberOfBlock="4"
app:shiftPosition="false" />
</LinearLayout>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ class BlockEditText : FrameLayout {
inputType
)
shiftPosition = a.getBoolean(
R.styleable.BlockEditText_bet_showCardIcon,
R.styleable.BlockEditText_showCardIcon,
true
)
isShowCardIcon = a.getBoolean(
R.styleable.BlockEditText_showCardIcon,
true
)
editTextStyle = a.getResourceId(
R.styleable.BlockEditText_bet_style, -1
R.styleable.BlockEditText_style, -1
)
val cardPrefix = a.getInt(
R.styleable.BlockEditText_cardPrefix,
Expand All @@ -161,7 +161,7 @@ class BlockEditText : FrameLayout {
}
setHintTextAppearance(hintTextAppearance)
shiftPosition = a.getBoolean(
R.styleable.BlockEditText_bet_shiftPosition,
R.styleable.BlockEditText_shiftPosition,
true
)
initLayout()
Expand Down Expand Up @@ -383,8 +383,8 @@ class BlockEditText : FrameLayout {
}
}

private fun setEdiTextBackground(editText: AEditText?, drawable: Drawable) {
ViewCompat.setBackground(editText!!, drawable.constantState!!.newDrawable())
private fun setEdiTextBackground(editText: AEditText?, drawable: Drawable?) {
ViewCompat.setBackground(editText!!, drawable?.constantState?.newDrawable())
}

fun setLengthAt(index: Int, length: Int) {
Expand Down

0 comments on commit 146ff03

Please sign in to comment.