Java Code Examples for android.widget.PopupWindow#OnDismissListener

The following examples show how to use android.widget.PopupWindow#OnDismissListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasePopupWindow.java    From AndroidProject with Apache License 2.0 5 votes vote down vote up
/**
 * 设置一个销毁监听器
 *
 * @param listener       销毁监听器对象
 * @deprecated           请使用 {@link #addOnDismissListener(BasePopupWindow.OnDismissListener)}
 */
@Deprecated
@Override
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    if (listener == null) {
        return;
    }
    addOnDismissListener(new DismissListenerWrapper(listener));
}
 
Example 2
Source File: DropdownPopupWindow.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an DropdownPopupWindow with specified parameters.
 * @param context Application context.
 * @param anchorView Popup view to be anchored.
 */
public DropdownPopupWindow(Context context, View anchorView) {
    super(context, null, 0, R.style.DropdownPopupWindow);
    mContext = context;
    mAnchorView = anchorView;

    mAnchorView.setId(R.id.dropdown_popup_window);
    mAnchorView.setTag(this);

    mLayoutChangeListener = new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            if (v == mAnchorView) DropdownPopupWindow.this.show();
        }
    };
    mAnchorView.addOnLayoutChangeListener(mLayoutChangeListener);

    super.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            if (mOnDismissListener != null) {
                mOnDismissListener.onDismiss();
            }
            mAnchorView.removeOnLayoutChangeListener(mLayoutChangeListener);
            mAnchorView.setTag(null);
        }
    });

    setAnchorView(mAnchorView);
    Rect originalPadding = new Rect();
    getBackground().getPadding(originalPadding);
    setVerticalOffset(-originalPadding.top);
}
 
Example 3
Source File: WidgetLiftManager.java    From Aria with Apache License 2.0 5 votes vote down vote up
/**
 * 创建popupWindow dismiss事件
 */
private PopupWindow.OnDismissListener createPopupWindowListener(final PopupWindow popupWindow) {
  return new PopupWindow.OnDismissListener() {
    @Override public void onDismiss() {
      AriaManager.getInstance().removeReceiver(popupWindow);
    }
  };
}
 
Example 4
Source File: FloatingToolbar.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public boolean setOutsideTouchable(boolean outsideTouchable, PopupWindow.OnDismissListener onDismiss) {
    boolean ret = false;
    if (mPopupWindow.isOutsideTouchable() ^ outsideTouchable) {
        mPopupWindow.setOutsideTouchable(outsideTouchable);
        mPopupWindow.setFocusable(!outsideTouchable);
        ret = true;
    }
    mPopupWindow.setOnDismissListener(onDismiss);
    return ret;
}
 
Example 5
Source File: IcsListPopupWindow.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mPopup.setOnDismissListener(listener);
}
 
Example 6
Source File: CustomPopupWindow.java    From YCDialog with Apache License 2.0 4 votes vote down vote up
/**
 * 设置弹窗关闭监听
 * @param onDismissListener listener
 */
public CustomPopupWindow.PopupWindowBuilder setOnDissmissListener(PopupWindow.OnDismissListener onDismissListener) {
    this.mCustomPopWindow.mOnDismissListener = onDismissListener;
    return this;
}
 
Example 7
Source File: ListPopMenu.java    From AndroidCacheFoundation with Apache License 2.0 4 votes vote down vote up
public ListPopMenu(Context context,BaseAdapter listAdapter,AdapterView.OnItemClickListener listener,PopupWindow.OnDismissListener dismissListener) {
    // TODO Auto-generated constructor stub
    this(context,R.layout.popdialog,listAdapter,listener,dismissListener,-1);
}
 
Example 8
Source File: AutocompletePopup.java    From Autocomplete with Apache License 2.0 4 votes vote down vote up
void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mPopup.setOnDismissListener(listener);
}
 
Example 9
Source File: IcsListPopupWindow.java    From zen4android with MIT License 4 votes vote down vote up
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mPopup.setOnDismissListener(listener);
}
 
Example 10
Source File: FloatingToolbar.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setOutsideTouchable(boolean outsideTouchable, PopupWindow.OnDismissListener onDismiss) {
    if (mPopup.setOutsideTouchable(outsideTouchable, onDismiss) && isShowing()) {
        dismiss();
        doShow();
    }
}
 
Example 11
Source File: FloatingToolbar.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setOutsideTouchable(boolean outsideTouchable, PopupWindow.OnDismissListener onDismiss) {
    if (mPopup.setOutsideTouchable(outsideTouchable, onDismiss) && isShowing()) {
        dismiss();
        doShow();
    }
}
 
Example 12
Source File: DropPopMenu.java    From AndroidWallet with GNU General Public License v3.0 4 votes vote down vote up
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}
 
Example 13
Source File: DropdownPopupWindow.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}
 
Example 14
Source File: FloatingActionMode.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setOutsideTouchable(boolean outsideTouchable, PopupWindow.OnDismissListener onDismiss) {
    mFloatingToolbar.setOutsideTouchable(outsideTouchable, onDismiss);
}
 
Example 15
Source File: IcsListPopupWindow.java    From android-apps with MIT License 4 votes vote down vote up
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mPopup.setOnDismissListener(listener);
}
 
Example 16
Source File: PopupWindows.java    From fanfouapp-opensource with Apache License 2.0 2 votes vote down vote up
/**
 * Set listener on window dismissed.
 * 
 * @param listener
 */
public void setOnDismissListener(
        final PopupWindow.OnDismissListener listener) {
    mWindow.setOnDismissListener(listener);
}
 
Example 17
Source File: ActivityChooserView.java    From android-apps with MIT License 2 votes vote down vote up
/**
 * Sets a listener to receive a callback when the popup is dismissed.
 *
 * @param listener The listener to be notified.
 */
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}
 
Example 18
Source File: ActivityChooserView.java    From zhangshangwuda with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a listener to receive a callback when the popup is dismissed.
 *
 * @param listener The listener to be notified.
 */
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}
 
Example 19
Source File: ActivityChooserView.java    From Libraries-for-Android-Developers with MIT License 2 votes vote down vote up
/**
 * Sets a listener to receive a callback when the popup is dismissed.
 *
 * @param listener The listener to be notified.
 */
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}
 
Example 20
Source File: ActivityChooserView.java    From CSipSimple with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Sets a listener to receive a callback when the popup is dismissed.
 *
 * @param listener The listener to be notified.
 */
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
    mOnDismissListener = listener;
}