/** * Gets the list popup window which is lazily initialized. * * @return The popup. */ private IcsListPopupWindow getListPopupWindow() { if (mListPopupWindow == null) { mListPopupWindow = new IcsListPopupWindow(getContext()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setAnchorView(ActivityChooserView.this); mListPopupWindow.setModal(true); mListPopupWindow.setOnItemClickListener(mCallbacks); mListPopupWindow.setOnDismissListener(mCallbacks); } return mListPopupWindow; }
/** * Gets the list popup window which is lazily initialized. * * @return The popup. */ private IcsListPopupWindow getListPopupWindow() { if (mListPopupWindow == null) { mListPopupWindow = new IcsListPopupWindow(getContext()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setAnchorView(ActivityChooserView.this); mListPopupWindow.setModal(true); mListPopupWindow.setOnItemClickListener(mCallbacks); mListPopupWindow.setOnDismissListener(mCallbacks); } return mListPopupWindow; }
public boolean tryShow() { mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle); mPopup.setOnDismissListener(this); mPopup.setOnItemClickListener(this);
public boolean tryShow() { mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle); mPopup.setOnDismissListener(this); mPopup.setOnItemClickListener(this); mAdapter = new MenuAdapter(mMenu); mPopup.setAdapter(mAdapter); mPopup.setModal(true); View anchor = mAnchorView; if (anchor != null) { final boolean addGlobalListener = mTreeObserver == null; mTreeObserver = anchor.getViewTreeObserver(); // Refresh to latest if (addGlobalListener) mTreeObserver.addOnGlobalLayoutListener(this); ((View_HasStateListenerSupport)anchor).addOnAttachStateChangeListener(this); mPopup.setAnchorView(anchor); } else { return false; } mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth)); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopup.show(); mPopup.getListView().setOnKeyListener(this); return true; }