diff options
| author | Tony Mantler <nicoya@google.com> | 2013-10-15 18:50:54 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-15 18:50:54 -0700 |
| commit | d1c1e3515f46ac74bf3ce1eb9e325762096dd8b2 (patch) | |
| tree | cc0e1334ddca3634768ee127eed83a9ebd5c66bc /src | |
| parent | 858e094f1c695aefdf6a23f522c0f16d81bd79f7 (diff) | |
| parent | 7894c8a217ea8507588a386f92b42f88a8ec6ba5 (diff) | |
| download | android_frameworks_opt_chips-d1c1e3515f46ac74bf3ce1eb9e325762096dd8b2.tar.gz android_frameworks_opt_chips-d1c1e3515f46ac74bf3ce1eb9e325762096dd8b2.tar.bz2 android_frameworks_opt_chips-d1c1e3515f46ac74bf3ce1eb9e325762096dd8b2.zip | |
am e444c661: am eaf43ea2: Don\'t show pop-ups and dialogs if we\'re not attached to a valid window.
* commit 'e444c661c53b942eea0daa120b3e5dcc58a0bdbe':
Don't show pop-ups and dialogs if we're not attached to a valid window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java index 2c4553f..ffd81a2 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -252,6 +252,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private int mActionBarHeight; + private boolean mAttachedToWindow; + public RecipientEditTextView(Context context, AttributeSet attrs) { super(context, attrs); setChipDimensions(context, attrs); @@ -294,6 +296,16 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements } @Override + protected void onDetachedFromWindow() { + mAttachedToWindow = false; + } + + @Override + protected void onAttachedToWindow() { + mAttachedToWindow = true; + } + + @Override public boolean onEditorAction(TextView view, int action, KeyEvent keyEvent) { if (action == EditorInfo.IME_ACTION_DONE) { if (commitDefault()) { @@ -1462,6 +1474,9 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements @Override protected void onPostExecute(final ListAdapter result) { + if (!mAttachedToWindow) { + return; + } int line = getLayout().getLineForOffset(getChipStart(currentChip)); int bottom; if (line == getLineCount() -1) { @@ -2034,6 +2049,9 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private void showAddress(final DrawableRecipientChip currentChip, final ListPopupWindow popup, int width) { + if (!mAttachedToWindow) { + return; + } int line = getLayout().getLineForOffset(getChipStart(currentChip)); int bottom = calculateOffsetFromBottom(line); // Align the alternates popup with the left side of the View, @@ -2808,6 +2826,9 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements } private void showCopyDialog(final String address) { + if (!mAttachedToWindow) { + return; + } mCopyAddress = address; mCopyDialog.setTitle(address); mCopyDialog.setContentView(R.layout.copy_chip_dialog_layout); |
