From 280c753ae30502a7ffa3648a2152b2b784327277 Mon Sep 17 00:00:00 2001 From: Evan Millar Date: Wed, 11 Nov 2009 14:59:22 -0800 Subject: [PATCH] Modify text validation behavior. -Only perform validation when the view is *losing* focus. -Don't perform validation when the window focus changes. This causes odd behavior like validation being peformed when menu is pressed, or long press dialogs pop-up. --- core/java/android/widget/AutoCompleteTextView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index 75d0f31bd735e..ce985e3bcd7b3 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -1027,7 +1027,6 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); - performValidation(); if (!hasWindowFocus && !mDropDownAlwaysVisible) { dismissDropDown(); } @@ -1036,7 +1035,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(focused, direction, previouslyFocusedRect); - performValidation(); + // Perform validation if the view is losing focus. + if (!focused) { + performValidation(); + } if (!focused && !mDropDownAlwaysVisible) { dismissDropDown(); }