Skip to content

Commit 9d22427

Browse files
committed
Feat. Added Option to hide drawable when text is empty
1 parent c6af753 commit 9d22427

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868

6969
/>
7070
```
71+
or
72+
```kotlin
73+
drawableEditTextTop.hasDrawable(/**YOUR VALIUE**/)
74+
75+
```
7176
When the value is false, then the drawable is hidden by default and vice versa
7277

7378

app/src/main/java/com/mindorks/editdrawabletextsample/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MainActivity : AppCompatActivity() {
2525
}
2626
}
2727
}
28-
28+
2929
})
3030
drawableEditTextLeft.setDrawableClickListener(object : OnDrawableClickListener {
3131
override fun onClick(target: DrawablePosition) {

editdrawabletext/src/main/java/com/mindorks/editdrawabletext/EditDrawableText.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EditDrawableText(context: Context, attrs: AttributeSet) : EditText(context
3838
hasDrawable(isDrawableShownWhenTextIsEmpty)
3939
}
4040

41-
private fun hasDrawable(value: Boolean) {
41+
fun hasDrawable(value: Boolean) {
4242
isDrawableShownWhenTextIsEmpty = value
4343
if (!isDrawableShownWhenTextIsEmpty) this.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
4444
invalidate()

0 commit comments

Comments
 (0)