android.widget.PopupWindow.OnDismissListener Java Examples

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: PaySucceedActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
private void pointMeSendRedPackage() {
    if (this.mHalfPlaySharePopwindow == null) {
        ShareUtils.RequestShareLink(this);
        if (this.mRedPacketBean != null) {
            this.mHalfPlaySharePopwindow = new HalfPlaySharePopwindow(this, 8, this.mRedPacketBean.title, this.mRedPacketBean.url, LetvUrlMaker.getSharedSucceedUrl(this.mRedPacketBean.channelId + "", this.mOrderId), this.mRedPacketBean.mobilePic, this.mRedPacketBean.shareDesc, this.mGiftShareAwardCallback);
            this.mHalfPlaySharePopwindow.showPopupWindow(this.mRoot);
            this.mHalfPlaySharePopwindow.setOnDismissListener(new OnDismissListener(this) {
                final /* synthetic */ PaySucceedActivity this$0;

                {
                    if (HotFix.PREVENT_VERIFY) {
                        System.out.println(VerifyLoad.class);
                    }
                    this.this$0 = this$0;
                }

                public void onDismiss() {
                    this.this$0.mHalfPlaySharePopwindow = null;
                }
            });
        }
    }
}
 
Example #2
Source File: LocalImageloaderActivity.java    From base-imageloader with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化展示文件夹的popupWindw
 */
private void initListDirPopupWindw()
{
	mListImageDirPopupWindow = new ListImageDirPopupWindow(
			LayoutParams.MATCH_PARENT, (int) (mScreenHeight * 0.7),
			mImageFloders, LayoutInflater.from(getApplicationContext())
					.inflate(R.layout.list_dir, null));

	mListImageDirPopupWindow.setOnDismissListener(new OnDismissListener()
	{

		@Override
		public void onDismiss()
		{
			// 设置背景颜色变暗
			WindowManager.LayoutParams lp = getWindow().getAttributes();
			lp.alpha = 1.0f;
			getWindow().setAttributes(lp);
		}
	});
	// 设置选择文件夹的回调
	mListImageDirPopupWindow.setOnImageDirSelected(this);
}
 
Example #3
Source File: LocalImageloaderActivity.java    From base-imageloader with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化展示文件夹的popupWindw
 */
private void initListDirPopupWindw()
{
	mListImageDirPopupWindow = new ListImageDirPopupWindow(
			LayoutParams.MATCH_PARENT, (int) (mScreenHeight * 0.7),
			mImageFloders, LayoutInflater.from(getApplicationContext())
					.inflate(R.layout.list_dir, null));

	mListImageDirPopupWindow.setOnDismissListener(new OnDismissListener()
	{

		@Override
		public void onDismiss()
		{
			// 设置背景颜色变暗
			WindowManager.LayoutParams lp = getWindow().getAttributes();
			lp.alpha = 1.0f;
			getWindow().setAttributes(lp);
		}
	});
	// 设置选择文件夹的回调
	mListImageDirPopupWindow.setOnImageDirSelected(this);
}
 
Example #4
Source File: MPPopMenu.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void showAsDropDown(View parent) {
	mPopupWindow.setBackgroundDrawable(new ColorDrawable());
	mPopupWindow.showAsDropDown(parent);
	// 设置允许在外点击消失
	mPopupWindow.setOutsideTouchable(true);
	// 使其聚集
	mPopupWindow.setFocusable(true);
	// 刷新状态
	mPopupWindow.update();
	mPopupWindow.setOnDismissListener(new OnDismissListener() {
		// 在dismiss中恢复透明度
		@Override
		public void onDismiss() {
		}
	});
}
 
Example #5
Source File: MPPopMenu.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void showAtLocation(View parent) {
	mPopupWindow.setBackgroundDrawable(new ColorDrawable());
	mContainerView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
	int[] location = new int[2];
	int popupWidth = mContainerView.getMeasuredWidth();
	int popupHeight =  mContainerView.getMeasuredHeight();
	parent.getLocationOnScreen(location);
	int x = (location[0] + parent.getWidth() / 2) - popupWidth / 2;
	int y = location[1] - popupHeight;
	mPopupWindow.showAtLocation(parent, Gravity.NO_GRAVITY, x , y);
	// 设置允许在外点击消失
	mPopupWindow.setOutsideTouchable(true);
	// 使其聚集
	mPopupWindow.setFocusable(true);
	// 刷新状态
	mPopupWindow.update();

	mPopupWindow.setOnDismissListener(new OnDismissListener() {

		// 在dismiss中恢复透明度
		@Override
		public void onDismiss() {
		}
	});
}
 
Example #6
Source File: VideoShotEditActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public void share() {
    if (this.currentPhotoPos < this.photoFileName.getPhoto().size() && this.vsShareInfoBean != null) {
        String str;
        String randText = ((PhotoInfoBean) this.photoFileName.getPhoto().get(this.currentPhotoPos)).getPhotoDesc();
        VideoShotShareInfoBean videoShotShareInfoBean = this.vsShareInfoBean;
        String str2 = ((PhotoInfoBean) this.photoFileName.getPhoto().get(this.currentPhotoPos)).photoPath;
        if (TextUtils.isEmpty(this.vsShareInfoBean.mVideoName)) {
            str = "";
        } else {
            str = this.vsShareInfoBean.mVideoName + " " + (this.vsShareInfoBean.mVideoBean == null ? "" : this.vsShareInfoBean.mVideoBean.episode);
        }
        videoShotShareInfoBean.mPhotoPath = getFileAddedHybridWatermark(str2, 2130838567, str, randText);
        VideoShotShareInfoBean videoShotShareInfoBean2 = this.vsShareInfoBean;
        if (TextUtils.isEmpty(randText)) {
            randText = getResources().getString(2131099925);
        }
        videoShotShareInfoBean2.mRandText = randText;
        if (this.mHalfPlaySharePopwindow == null) {
            ShareUtils.RequestShareLink(this.mContext);
            this.mHalfPlaySharePopwindow = new HalfPlaySharePopwindow(this, 4);
            this.mHalfPlaySharePopwindow.setVideoShotData(this.vsShareInfoBean);
            this.mHalfPlaySharePopwindow.showPopupWindow(this.mRootLayout);
            this.mHalfPlaySharePopwindow.setOnDismissListener(new OnDismissListener(this) {
                final /* synthetic */ VideoShotEditActivity this$0;

                {
                    if (HotFix.PREVENT_VERIFY) {
                        System.out.println(VerifyLoad.class);
                    }
                    this.this$0 = this$0;
                }

                public void onDismiss() {
                    this.this$0.mHalfPlaySharePopwindow = null;
                }
            });
        }
    }
}
 
Example #7
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void showFeatureEngagementTextBubbleForDownloadHome() {
    final FeatureEngagementTracker tracker =
            FeatureEngagementTrackerFactory.getFeatureEngagementTrackerForProfile(
                    Profile.getLastUsedProfile());
    if (!tracker.shouldTriggerHelpUI(FeatureConstants.DOWNLOAD_HOME_FEATURE)) return;

    ViewAnchoredTextBubble textBubble = new ViewAnchoredTextBubble(this,
            getToolbarManager().getMenuButton(), R.string.iph_download_home_text,
            R.string.iph_download_home_accessibility_text);
    textBubble.setDismissOnTouchInteraction(true);
    textBubble.addOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss() {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    tracker.dismissed(FeatureConstants.DOWNLOAD_HOME_FEATURE);
                    getAppMenuHandler().setMenuHighlight(null);
                }
            });
        }
    });
    getAppMenuHandler().setMenuHighlight(R.id.downloads_menu_id);
    int yInsetPx =
            getResources().getDimensionPixelOffset(R.dimen.text_bubble_menu_anchor_y_inset);
    textBubble.setInsetPx(0, FeatureUtilities.isChromeHomeEnabled() ? yInsetPx : 0, 0,
            FeatureUtilities.isChromeHomeEnabled() ? 0 : yInsetPx);
    textBubble.show();
}
 
Example #8
Source File: TextBubble.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss() {
    if (mIgnoreDismissal) return;

    mHandler.removeCallbacks(mDismissRunnable);
    for (OnDismissListener listener : mDismissListeners) listener.onDismiss();
}
 
Example #9
Source File: LayoutView.java    From Makeblock-App-For-Android with MIT License 5 votes vote down vote up
protected void startUpgradeing(){
	
	stopTimer();
	startTimer(500);
	engineState = STAGE_PROBING;
	
	if(blt!=null){
		blt.commMode = Bluetooth.MODE_FORWARD;
	}else{
		BluetoothLE.sharedManager().commMode = BluetoothLE.MODE_FORWARD;
	}
	
	uploadPb = ProgressDialog.show(this.mContext, getString(R.string.Upgrade_Firmware), getString(R.string.Please_Press_Reset_Button));
	uploadPb.setCancelable(true);
	uploadPb.setOnDismissListener(new DialogInterface.OnDismissListener() {
           @Override
           public void onDismiss(DialogInterface dialog) {
           	if(blt!=null){
           		blt.commMode = Bluetooth.MODE_LINE;
           	}else{
           		BluetoothLE.sharedManager().commMode = BluetoothLE.MODE_LINE;
           	}
			stopTimer();
			engineState = STAGE_IDLE;
			disableAllModule();
			runBtn.setImageResource(R.drawable.run_button);
			//startTimer(1000);
           }
       });
}
 
Example #10
Source File: QuickAction.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
/**
 * Set listener for window dismissed. This listener will only be fired if
 * the quicakction dialog is dismissed by clicking outside the dialog or
 * clicking on sticky item.
 */
public void setOnDismissListener(
        final QuickAction.OnDismissListener listener) {
    setOnDismissListener(this);

    mDismissListener = listener;
}
 
Example #11
Source File: ExitRetainPopupwindow.java    From letv with Apache License 2.0 4 votes vote down vote up
private void initPopupwindow() {
    this.mPopupWindow = new ExitRetainMyPopupwindow(LetvApplication.getInstance());
    this.mPopupWindow.setWidth(UIs.getScreenWidth());
    this.mPopupWindow.setHeight(UIs.getScreenHeight());
    if (VERSION.SDK_INT >= 11) {
        this.mPopupWindow.setFocusable(true);
    }
    this.mPopupWindow.setBackgroundDrawable(new BitmapDrawable(this.mContext.getResources()));
    this.contentView = LayoutInflater.from(this.mContext).inflate(R.layout.exit_retain_popupwindow, null);
    this.mPopupWindow.setContentView(this.contentView);
    this.mPopupWindow.setOnDismissListener(new OnDismissListener(this) {
        final /* synthetic */ ExitRetainPopupwindow this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void onDismiss() {
            LogInfo.log(ExitRetainPopupwindow.TAG, " onDismiss isClickLookBtn : " + this.this$0.isClickLookBtn + " isNewUser " + this.this$0.isNewUser() + " isFristShow : " + this.this$0.mCurrentHomeMetaData.isFristShow);
            if (this.this$0.mCurrentHomeMetaData == null || this.this$0.mCurrentHomeMetaData.isFristShow || !this.this$0.isNewUser() || this.this$0.mExitRetainDataMap.size() <= 1) {
                if (!this.this$0.isClickLookBtn || !this.this$0.isNewUser()) {
                    this.this$0.mExitRetainDataMap.clear();
                } else if (this.this$0.isNewUser()) {
                    this.this$0.isClickLookBtn = false;
                }
                this.this$0.mExitRetainCallBack.onDismissPopWindow();
                return;
            }
            LogInfo.log(" 当前对话框是不带按钮的 ");
        }
    });
    this.mPopupWindow.setDismissListener(new DismissListener(this) {
        final /* synthetic */ ExitRetainPopupwindow this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void onPreDismiss() {
            LogInfo.log(ExitRetainPopupwindow.TAG, "initPopupwindow  onPreDismiss >> ");
            if (this.this$0.isClickBackKey()) {
                this.this$0.pressBackKey = true;
            }
        }

        public void onDismissed() {
            LogInfo.log(ExitRetainPopupwindow.TAG, "initPopupwindow  onDismissed >> " + this.this$0.pressBackKey);
            if (!this.this$0.pressBackKey || this.this$0.mCurrentHomeMetaData == null || this.this$0.mCurrentHomeMetaData.isFristShow || this.this$0.mExitRetainCallBack == null) {
                this.this$0.pressBackKey = false;
                return;
            }
            LogInfo.log(ExitRetainPopupwindow.TAG, "initPopupwindow  onExitAppliation >> ");
            this.this$0.mExitRetainCallBack.onExitAppliation();
        }
    });
}
 
Example #12
Source File: PlayerFragment.java    From edx-app-android with Apache License 2.0 4 votes vote down vote up
private void showSettingsPopup(final Point p) {
    try{
        if(player!=null){
            player.getController().setAutoHide(!getTouchExploreEnabled());
            Activity context = getActivity();

            float popupHeight =  getResources().getDimension(R.dimen.settings_popup_height);
            float popupWidth =  getResources().getDimension(R.dimen.settings_popup_width);

            // Inflate the popup_layout.xml
            LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.setting_popup);
            LayoutInflater layoutInflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View layout = layoutInflater.inflate(R.layout.panel_settings_popup, viewGroup);

            // Creating the PopupWindow
            settingPopup = new PopupWindow(context);
            settingPopup.setContentView(layout);
            settingPopup.setWidth((int)popupWidth);
            settingPopup.setHeight((int)popupHeight);
            settingPopup.setFocusable(true);
            settingPopup.setOnDismissListener(new OnDismissListener() {
                @Override
                public void onDismiss() {
                    hideTransparentImage();
                    if(player!=null){
                        player.getController().setSettingsBtnDrawable(false);
                        player.getController().setAutoHide(!getTouchExploreEnabled());
                    }
                }
            });

            // Clear the default translucent background
            settingPopup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

            // Displaying the popup at the specified location, + offsets.
            settingPopup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x-(int)popupWidth, p.y-(int)popupHeight);

            TextView tv_closedCaption = (TextView) layout.findViewById(R.id.tv_closedcaption);
            if ((langList != null) && (langList.size() > 0))
            {
                tv_closedCaption.setBackgroundResource(R.drawable.white_rounded_selector);
                tv_closedCaption.setOnClickListener(new View.OnClickListener(){
                    public void onClick(View paramAnonymousView) {
                        showCCFragmentPopup();
                    }
                });
            }else{
                tv_closedCaption.setBackgroundResource(R.drawable.grey_roundedbg);
                tv_closedCaption.setOnClickListener(null);
            }

            layout.findViewById(R.id.tv_video_speed).setOnClickListener(v -> showVideoSpeedFragmentPopup());
        }
    }catch(Exception e){
        logger.error(e);
    }
}
 
Example #13
Source File: TextBubble.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * @param onDismissListener A listener to be called when the bubble is dismissed.
 * @see PopupWindow#setOnDismissListener(OnDismissListener)
 */
public void addOnDismissListener(OnDismissListener onDismissListener) {
    mDismissListeners.addObserver(onDismissListener);
}
 
Example #14
Source File: TextBubble.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * @param onDismissListener The listener to remove and not call when the bubble is dismissed.
 * @see PopupWindow#setOnDismissListener(OnDismissListener)
 */
public void removeOnDismissListener(OnDismissListener onDismissListener) {
    mDismissListeners.removeObserver(onDismissListener);
}
 
Example #15
Source File: GlobalStatusMenu.java    From jitsi-android with Apache License 2.0 2 votes vote down vote up
/**
 * Set listener for window dismissed. This listener will only be fired if
 * the quicakction dialog is dismissed by clicking outside the dialog or
 * clicking on sticky item.
 */
public void setOnDismissListener(GlobalStatusMenu.OnDismissListener listener)
{
    mDismissListener = listener;
}