Skip to content

Commit

Permalink
[feature/common/royal_flush_edit_text]: #9 feat: Royal Flush Edit Tex…
Browse files Browse the repository at this point in the history
…t End Icon 속성 구현
  • Loading branch information
soopeach committed May 10, 2023
1 parent 84c314b commit 8a11ff6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ class RoyalFlushEditText(context: Context, attrs: AttributeSet): ConstraintLayou
0, 0
).apply {
try {
getResourceId(R.styleable.RoyalFlushEditText_StartIcon, EMPTY_RESOURCE).let { resource ->
getResourceId(R.styleable.RoyalFlushEditText_startIcon, EMPTY_RESOURCE).let { resource ->
if (resource == EMPTY_RESOURCE) {
binding.startIc.visibility = GONE
} else {
binding.startIc.setImageResource(resource)
}
}

getResourceId(R.styleable.RoyalFlushEditText_endIcon, EMPTY_RESOURCE).let { resource ->
if (resource == EMPTY_RESOURCE) {
binding.endIc.visibility = GONE
} else {
binding.endIc.setImageResource(resource)
}
}

} finally {
recycle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@
android:maxLines="1"
android:inputType="text"
app:layout_constraintStart_toEndOf="@id/start_ic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@id/end_ic"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:autofillHints="yes"
tools:ignore="LabelFor" />

<ImageView
android:id="@+id/end_ic"
android:layout_width="0dp"
android:layout_height="0dp"
android:paddingStart="4dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/et"
app:layout_constraintBottom_toBottomOf="@id/et"
android:contentDescription="@string/start_ic" />

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions feature/feature-common/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<resources>
<declare-styleable name="RoyalFlushEditText">
<attr name="startIcon" format="reference"/>
<attr name="endIcon" format="reference"/>
</declare-styleable>
</resources>
1 change: 1 addition & 0 deletions feature/feature-common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="start_ic">시작 아이콘</string>
<string name="end_ic">끝 아이콘</string>
</resources>

0 comments on commit 8a11ff6

Please sign in to comment.