Java Code Examples for android.widget.PopupWindow#dismiss()

The following examples show how to use android.widget.PopupWindow#dismiss() . 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: BaldActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPause() {
    for (WeakReference<Dialog> dialogWeakReference : dialogsToClose) {
        final Dialog dialog = dialogWeakReference.get();
        if (dialog != null)
            dialog.dismiss();
    }

    for (WeakReference<PopupWindow> windowWeakReference : popupWindowsToClose) {
        final PopupWindow window = windowWeakReference.get();
        if (window != null)
            window.dismiss();
    }

    if (useAccidentalGuard)
        sensorManager.unregisterListener(this);
    super.onPause();
}
 
Example 2
Source File: BeerActivity.java    From ratebeer with GNU General Public License v3.0 6 votes vote down vote up
private void addBeerToCustomList(Beer beer, long listId, PopupWindow popup) {
	Db.getCustomListBeer(this, listId, beer._id)
			.compose(bindToLifecycle())
			.defaultIfEmpty(null)
			.subscribe(existingBeerOnList -> {
				if (existingBeerOnList == null) {
					CustomListBeer addBeer = new CustomListBeer();
					addBeer.listId = listId;
					addBeer.beerId = beer._id;
					addBeer.beerName = beer.name;
					rxdb(this).put(addBeer);
					listAddButton.setChecked(true);
				} else {
					rxdb(this).delete(existingBeerOnList);
					listAddButton.setChecked(false);
				}
			});
	popup.dismiss();
}
 
Example 3
Source File: WxShareDialog.java    From WanAndroid with MIT License 5 votes vote down vote up
public static void showWxShareDialog(Context context, View parent, Article article) {
    PopupWindow popupWindow = new PopupWindow(LayoutInflater.from(context).inflate(R.layout.wechat_share, null), ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    View.OnClickListener listener = (View v) -> {
        switch (v.getId()) {
            case R.id.share_friends:
                WxShareUtils.getInstance().shareToWeChat(context, article.getLink(), article.getTitle(), article.getDesc(), 0);
                break;
            case R.id.share_timeline:
                WxShareUtils.getInstance().shareToWeChat(context, article.getLink(), article.getTitle(), article.getDesc(), 1);
                break;
            default:
                Log.e("WxShareDialg", "no this view" + v.getId());
        }
        popupWindow.dismiss();
    };


    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);
    popupWindow.setBackgroundDrawable(context.getDrawable(R.drawable.wx_share_bg));

    popupWindow.getContentView().findViewById(R.id.share_friends).setOnClickListener(listener);
    popupWindow.getContentView().findViewById(R.id.share_timeline).setOnClickListener(listener);

    popupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
}
 
Example 4
Source File: DialogUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 关闭 PopupWindow
 * @param popupWindow {@link PopupWindow}
 * @return {@code true} success, {@code false} fail
 */
public static boolean closePopupWindow(final PopupWindow popupWindow) {
    if (popupWindow != null && popupWindow.isShowing()) {
        try {
            popupWindow.dismiss();
            return true;
        } catch (Exception e) {
            LogPrintUtils.eTag(TAG, e, "closePopupWindow");
        }
    }
    return false;
}
 
Example 5
Source File: DialogUtils.java    From letv with Apache License 2.0 4 votes vote down vote up
public static void closeDialog(PopupWindow popup) {
    if (popup != null) {
        popup.dismiss();
    }
}
 
Example 6
Source File: NotifyHelper.java    From nono-android with GNU General Public License v3.0 4 votes vote down vote up
public  static void popUpWaitingAnimationFinished(PopupWindow popupWindow)
{
	if(popupWindow !=null){
		popupWindow.dismiss();
	}
}