From: Damyan Ivanov Date: Sat, 21 Sep 2019 17:52:04 +0000 (+0300) Subject: AutoWithClear: manage the drawable on text change only if having focus X-Git-Tag: v0.11.0~103 X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=commitdiff_plain;h=94270f0986ed02ae35efe770f9fd0163f83313ed AutoWithClear: manage the drawable on text change only if having focus --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/AutoCompleteTextViewWithClear.java b/app/src/main/java/net/ktnx/mobileledger/ui/AutoCompleteTextViewWithClear.java index 8b714dac..8b73de1d 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/AutoCompleteTextViewWithClear.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/AutoCompleteTextViewWithClear.java @@ -63,8 +63,10 @@ public final class AutoCompleteTextViewWithClear extends AppCompatAutoCompleteTe protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { final boolean hasText = text.length() > 0; - if (hadText && !hasText) hideClearDrawable(); - if (!hadText && hasText) showClearDrawable(); + if (hasFocus()) { + if (hadText && !hasText) hideClearDrawable(); + if (!hadText && hasText) showClearDrawable(); + } hadText = hasText;