diff options
| author | Jin Cao <jinyan@google.com> | 2014-11-10 22:00:14 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-10 22:00:14 +0000 |
| commit | 87eed3cfd0064739def068aabe9e911ba27de84b (patch) | |
| tree | 6083cfc0784425200d31294ff34e5e0154a4bca5 | |
| parent | dd83bafb836c3f60a050f7f5045d9e0805af7e37 (diff) | |
| parent | 18eefa523611ccd2165e6d79621f50ed038bb45d (diff) | |
| download | android_frameworks_opt_chips-87eed3cfd0064739def068aabe9e911ba27de84b.tar.gz android_frameworks_opt_chips-87eed3cfd0064739def068aabe9e911ba27de84b.tar.bz2 android_frameworks_opt_chips-87eed3cfd0064739def068aabe9e911ba27de84b.zip | |
am 18eefa52: Merge "Auto dismiss popups when touches happen outside the popup window" into ub-chips-cranbrook
* commit '18eefa523611ccd2165e6d79621f50ed038bb45d':
Auto dismiss popups when touches happen outside the popup window
| -rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java index c05da59..f470264 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -86,6 +86,7 @@ import android.widget.ListAdapter; import android.widget.ListPopupWindow; import android.widget.ListView; import android.widget.MultiAutoCompleteTextView; +import android.widget.PopupWindow; import android.widget.ScrollView; import android.widget.TextView; @@ -266,9 +267,9 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements sSelectedTextColor = context.getResources().getColor(android.R.color.white); } mAlternatesPopup = new ListPopupWindow(context); - mAlternatesPopup.setBackgroundDrawable(null); + setupPopupWindow(mAlternatesPopup); mAddressPopup = new ListPopupWindow(context); - mAddressPopup.setBackgroundDrawable(null); + setupPopupWindow(mAddressPopup); mCopyDialog = new Dialog(context); mAlternatesListener = new OnItemClickListener() { @Override @@ -304,6 +305,16 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements setDropdownChipLayouter(new DropdownChipLayouter(LayoutInflater.from(context), context)); } + private void setupPopupWindow(ListPopupWindow popup) { + popup.setModal(true); + popup.setOnDismissListener(new PopupWindow.OnDismissListener() { + @Override + public void onDismiss() { + clearSelectedChip(); + } + }); + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); |
