]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/AutoCompleteTextViewWithClear.java
AutoWithClear: manage the drawable on text change only if having focus
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / AutoCompleteTextViewWithClear.java
index 8b714dac29de31de0f7edbb4ed6d666cfe1f5e2f..8b73de1d331c68c4ff7207c2e2913ae446c82332 100644 (file)
@@ -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;