diff options
author | Bjorn Bringert <bringert@android.com> | 2009-06-11 12:30:48 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-06-11 12:30:48 +0100 |
commit | 50145bc883909c4b1533894a2b947eed21312514 (patch) | |
tree | 30d64220415b1fa77bbf6cfac661e956b4ea22d7 /core/java | |
parent | a05487dd856222bacf57a41f2dfe1194d3776f05 (diff) | |
download | frameworks_base-50145bc883909c4b1533894a2b947eed21312514.zip frameworks_base-50145bc883909c4b1533894a2b947eed21312514.tar.gz frameworks_base-50145bc883909c4b1533894a2b947eed21312514.tar.bz2 |
ACTV: getWindowVisibility() instead of private attach count
When debugging a problem with the search dialog drop-down
sometimes not showing up, I saw that the mAttachCount variable
in AutoCompleteTextView could get a negative value because
onDetachedFromWindow() was called multiple times. This lead to
the drop-down not being displayed on filtering.
Instead of the private attach count in ACTV, this change
uses View.getWindowVisibility().
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/AutoCompleteTextView.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index f376ce5..585ce3d 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -123,10 +123,6 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe private AutoCompleteTextView.ListSelectorHider mHideSelector; - // Indicates whether this AutoCompleteTextView is attached to a window or not - // The widget is attached to a window when mAttachCount > 0 - private int mAttachCount; - private AutoCompleteTextView.PassThroughClickListener mPassThroughClickListener; public AutoCompleteTextView(Context context) { @@ -960,7 +956,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe /** {@inheritDoc} */ public void onFilterComplete(int count) { - if (mAttachCount <= 0) return; + // Not attached to window, don't update drop-down + if (getWindowVisibility() == View.GONE) return; /* * This checks enoughToFilter() again because filtering requests @@ -999,13 +996,11 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - mAttachCount++; } @Override protected void onDetachedFromWindow() { dismissDropDown(); - mAttachCount--; super.onDetachedFromWindow(); } |