android.content.DialogInterface.OnDismissListener Java Examples

The following examples show how to use android.content.DialogInterface.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: X8TLRDialogManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void showTakeOffDialog() {
    this.mX8TakeOffDialog = new X8TLRDialog(this.x8RightIconForMapController.getActivity(), this.x8RightIconForMapController.getString(R.string.x8_ai_fly_take_off_title), String.format(this.x8RightIconForMapController.getString(R.string.x8_ai_fly_take_off_tip), new Object[]{X8NumberUtil.getDistanceNumberString(4.0f, 1, false)}), false, R.drawable.x8_img_take_off_flag, new onDialogButtonClickListener() {
        public void onLeft() {
        }

        public void onRight() {
            X8TLRDialogManager.this.onTakeOffClick();
        }
    });
    this.mX8TakeOffDialog.setOnDismissListener(new OnDismissListener() {
        public void onDismiss(DialogInterface dialog) {
            X8TLRDialogManager.this.mX8TakeOffDialog = null;
        }
    });
    this.mX8TakeOffDialog.setCanceledOnTouchOutside(false);
    this.mX8TakeOffDialog.show();
}
 
Example #2
Source File: UpdaterDialogManager.java    From TurkcellUpdater_android_sdk with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a dialog for given message.
 *
 * @param activity        Parent activity.
 * @param message         Message contents
 * @param dismissListener Listener that will be called when dialog is closed or
 *                        cancelled.
 * @return Created dialog.
 */
public static Dialog createMessageDialog(Activity activity, Message message, OnDismissListener dismissListener) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    final String title = message.description == null ? null : message.description.get(MessageDescription.KEY_TITLE);
    if (!Utilities.isNullOrEmpty(title)) {
        builder.setTitle(title);
    }
    final View dialogContentsView = createMessageDialogContentsView(activity, message.description);
    builder.setView(dialogContentsView);
    initializeMessageDialogButtons(activity, builder, message);
    builder.setCancelable(true);
    final AlertDialog dialog = builder.create();
    if (Utilities.isNullOrEmpty(title)) {
        dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    }
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
Example #3
Source File: RMBTTestFragment.java    From open-rmbt with Apache License 2.0 6 votes vote down vote up
protected void showErrorDialog(int errorMessageId)
{
    stopLoop = true;
    
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.test_dialog_error_title);
    builder.setMessage(errorMessageId);
    builder.setNeutralButton(android.R.string.ok, null);
    dismissDialogs();
    errorDialog = builder.create();
    errorDialog.setOnDismissListener(new OnDismissListener()
    {
        @Override
        public void onDismiss(DialogInterface dialog)
        {
            final RMBTMainActivity activity = (RMBTMainActivity) getActivity();
            if (activity != null)
                activity.getSupportFragmentManager().popBackStack();
        }
    });
    errorDialog.show();
}
 
Example #4
Source File: AccelerationAlertActivity.java    From AccelerationAlert with Apache License 2.0 6 votes vote down vote up
/**
 * Show a dialog with the acceleration event settings.
 */
private void showSettingsDialog()
{
	SettingsDialog dialog = new SettingsDialog(this);

	dialog.setOnDismissListener(new OnDismissListener()
	{
		@Override
		public void onDismiss(DialogInterface arg0)
		{
			// Read the new preferences.
			readPrefs();
		}
	});

	dialog.show();
}
 
Example #5
Source File: SingleChoiceDialogFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(final Activity activity) {

    super.onAttach(activity);

    if (activity instanceof OnClickListener) {
        mClickListener = (OnClickListener) activity;
    }

    else {
        throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener");
    }

    if (activity instanceof OnDismissListener) {
        mOnDismissListener = (OnDismissListener) activity;
    }
}
 
Example #6
Source File: EnableLocationDialogFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(final Activity activity) {

    super.onAttach(activity);

    if (activity instanceof OnClickListener) {
        mClickListener = (OnClickListener) activity;
    }

    else {
        throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener");
    }

    if (activity instanceof OnDismissListener) {
        mOnDismissListener = (OnDismissListener) activity;
    }
}
 
Example #7
Source File: AddSingleEditTextDialogFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(final Activity activity) {

    super.onAttach(activity);

    if (activity instanceof OnClickListener) {
        mClickListener = (OnClickListener) activity;
    }

    else {
        throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener");
    }

    if (activity instanceof OnDismissListener) {
        mOnDismissListener = (OnDismissListener) activity;
    }
}
 
Example #8
Source File: AlertDialogFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(final Activity activity) {

    super.onAttach(activity);

    if (activity instanceof OnClickListener) {
        mClickListener = (OnClickListener) activity;
    }

    else {
        throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener");
    }

    if (activity instanceof OnDismissListener) {
        mOnDismissListener = (OnDismissListener) activity;
    }
}
 
Example #9
Source File: AddUserInfoDialogFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onAttach(final Activity activity) {

    super.onAttach(activity);

    if (activity instanceof OnClickListener) {
        mClickListener = (OnClickListener) activity;
    }

    else {
        throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener");
    }

    if (activity instanceof OnDismissListener) {
        mOnDismissListener = (OnDismissListener) activity;
    }
}
 
Example #10
Source File: Player.java    From M3UPlayer with Apache License 2.0 6 votes vote down vote up
private void browse() {
	if (mBrowser == null) {
		mBrowser = FileBrowser.createFileBrowser(this, "/", ".m3u", new OnFileSelectedListener() {
			
			@Override
			public void onFileSelected(String path) {
				prepareData(path);
				if (mBrowser != null && mBrowser.isShowing()) {
					mBrowser.dismiss();
				}
			}
		});
		mBrowser.setOnDismissListener(new OnDismissListener() {
			
			@Override
			public void onDismiss(DialogInterface dialog) {
				mBrowse.requestFocus();
			}
		});
	}
	mBrowser.show();
}
 
Example #11
Source File: CommonUtils.java    From freeiot-android with MIT License 6 votes vote down vote up
public static final void showProgressDialog(Context context, String title,
		String message, OnDismissListener onDismissListener) {
	if (context == null) {
		return;
	}
	dismissDialog();
	if (TextUtils.isEmpty(title)) {
		title = "";
	}
	if (TextUtils.isEmpty(message)) {
		message = context.getString(R.string.loading);
	}
	mProgressDialog = ProgressDialog.show(context, title, message);
	mProgressDialog.setCancelable(true);
	mProgressDialog.setCanceledOnTouchOutside(false);
	mProgressDialog.setOnDismissListener(onDismissListener);
}
 
Example #12
Source File: Symbol.java    From PdDroidPublisher with GNU General Public License v3.0 6 votes vote down vote up
private void openEditDialog()
{
	final SymbolDialog editDialog = new SymbolDialog(parent.getContext(), value);
	editDialog.setTitle(label == null ? "Edit symbol" : label);
	editDialog.setOnDismissListener(new OnDismissListener() {
		@Override
		public void onDismiss(DialogInterface dialog) {
			String selectedValue = editDialog.getSelectedValue();
			if(selectedValue != null)
			{
				setValue(selectedValue);
				parent.invalidate();
			}
		}
	});
	editDialog.show();
}
 
Example #13
Source File: Numberbox.java    From PdDroidPublisher with GNU General Public License v3.0 6 votes vote down vote up
private void openEditDialog()
{
	final NumberboxDialog editDialog = new NumberboxDialog(parent.getContext(), val);
	editDialog.setTitle(label == null ? "Edit number" : label);
	editDialog.setOnDismissListener(new OnDismissListener() {
		@Override
		public void onDismiss(DialogInterface dialog) {
			Float selectedValue = editDialog.getSelectedValue();
			if(selectedValue != null)
			{
				setval(selectedValue.floatValue());
				sendFloat(val);
				parent.invalidate();
			}
		}
	});
	editDialog.show();
}
 
Example #14
Source File: PopupTaplist.java    From PdDroidPublisher with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean touchdown(int pid, float x, float y) {

	if (dRect.contains(x, y)) {
		final Selector selector = new Selector(parent.getContext(), getValues());

		selector.setOnDismissListener(new OnDismissListener() {				
			@Override
			public void onDismiss(DialogInterface dialog) {
				Integer v = selector.getSelectedValue();
				if (v != null){
					val = v;
					doSend();
					parent.threadSafeInvalidate();
				}
				dialog.dismiss();
			}
		});	
		selector.show();
		return true;
	}
	return false;
}
 
Example #15
Source File: X8TLRDialogManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void showReturnDialog() {
    this.mX8ReturnDialog = new X8TLRDialog(this.x8RightIconForMapController.getActivity(), this.x8RightIconForMapController.getString(R.string.x8_ai_fly_return_home_title), "", true, 0, new onDialogButtonClickListener() {
        public void onLeft() {
        }

        public void onRight() {
            X8TLRDialogManager.this.onRetureHomeClick();
        }
    });
    this.mX8ReturnDialog.setOnDismissListener(new OnDismissListener() {
        public void onDismiss(DialogInterface dialog) {
            X8TLRDialogManager.this.mX8ReturnDialog = null;
        }
    });
    this.mX8ReturnDialog.setCanceledOnTouchOutside(false);
    this.mX8ReturnDialog.show();
}
 
Example #16
Source File: X8TLRDialogManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void showLandingDialog() {
    this.mX8LandingDialog = new X8TLRDialog(this.x8RightIconForMapController.getActivity(), this.x8RightIconForMapController.getString(R.string.x8_ai_fly_land_title), this.x8RightIconForMapController.getString(R.string.x8_ai_fly_land_tip), false, R.drawable.x8_img_landing_flag, new onDialogButtonClickListener() {
        public void onLeft() {
        }

        public void onRight() {
            X8TLRDialogManager.this.onLandingClick();
        }
    });
    this.mX8LandingDialog.setOnDismissListener(new OnDismissListener() {
        public void onDismiss(DialogInterface dialog) {
            X8TLRDialogManager.this.mX8LandingDialog = null;
        }
    });
    this.mX8LandingDialog.setCanceledOnTouchOutside(false);
    this.mX8LandingDialog.show();
}
 
Example #17
Source File: CarlifeActivity.java    From apollo-DuerOS with Apache License 2.0 6 votes vote down vote up
public void openExitAppDialog() {
    mExitAppDialog = new CarlifeMessageDialog(this).setTitleText(R.string.alert_quit)
            .setMessage(R.string.alert_quit_app_content).setFirstBtnText(R.string.alert_confirm)
            .setFirstBtnTextColorHighLight().setOnFirstBtnClickListener(new OnCarlifeClickListener() {
                @Override
                public void onClick() {
                    exitApp();
                }
            }).setSecondBtnText(R.string.alert_cancel);

    mExitAppDialog.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mExitAppDialog = null;
        }
    });

    if (!mExitAppDialog.isShowing()) {
        try {
            mExitAppDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #18
Source File: CarlifeActivity.java    From apollo-DuerOS with Apache License 2.0 6 votes vote down vote up
public void openExitAppDialogOnReadConfFail() {
    mExitAppDialog = new CarlifeMessageDialog(this).setTitleText(R.string.alert_quit)
            .setMessage(R.string.conf_init_fail).setOnFirstBtnClickListener(new OnCarlifeClickListener() {
                @Override
                public void onClick() {
                    exitApp();
                }
            }).setFirstBtnText(R.string.alert_confirm);

    mExitAppDialog.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mExitAppDialog = null;
        }
    });

    if (!mExitAppDialog.isShowing()) {
        try {
            mExitAppDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #19
Source File: ActivityDlgActionInput.java    From LibreTasks with Apache License 2.0 6 votes vote down vote up
/**
 * Show the attributes dialog for the specified {@code viewItem} if applicable
 * 
 * @param viewItem
 *          the item chosen to show the attributes
 */
private void showDialogAttributes(final ViewItem viewItem) {

  ArrayList<ModelAttribute> attributesValid = (ArrayList<ModelAttribute>) getAttributes(viewItem);
  // Show the dialog finally if they have any choice.
  if (!attributesValid.isEmpty()) {
    DlgAttributes dlg = new DlgAttributes(this, attributesValid);
    dlg.setOnDismissListener(new OnDismissListener() {
      public void onDismiss(DialogInterface dialog) {
        // Fetch the attribute they chose, if any.
        ModelAttribute modelAttribute = ((DlgAttributes) dialog).getSelectedAttribute();

        if (modelAttribute != null) {
          viewItem.insertAttribute(modelAttribute);
        }
      }
    });
    dlg.show();
  } else {
    // Shouldn't happen but leaving in for safety
    UtilUI.showAlert(this, "Sorry!",
        "There are no matching parameters for the selected attribute type!");
  }
}
 
Example #20
Source File: LoginActivity.java    From freeiot-android with MIT License 5 votes vote down vote up
public void onPrepare() {
	CommonUtils.showProgressDialog(LoginActivity.this, null, getString(R.string.logining), new OnDismissListener() {

              @Override
              public void onDismiss(DialogInterface dialog) {
                  LogUtils.d("progress dialog onDissmiss Listener, cancel login...");
                  UserApi.cancel(LoginActivity.this, true);
              }
          });
}
 
Example #21
Source File: CandidateView.java    From sinovoice-pathfinder with MIT License 5 votes vote down vote up
/**
     * ��ʼ��¼��dialog
     */
    private void initAsrDialog() {
        mRecorderDialog = new JTAsrRecorderDialog(mService, asrListener);
        Window window = mRecorderDialog.getWindow();
        window.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
//        window.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        mRecorderDialog.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                if(TextUtils.isEmpty(mAsrResult)){
                    return;
                }
                
                Message msg = mHandler.obtainMessage(Pathfinder.MSG_WHAT_ASR_RESULT, mAsrResult);
                mHandler.sendMessage(msg);
                mAsrResult = "";
            }
        });

        JTAsrRecogParams asrRecogParams = new JTAsrRecogParams();
        asrRecogParams.setCapKey(SysConfig.CAPKEY_ASR);
        asrRecogParams
                .setAudioFormat(HciCloudAsr.HCI_ASR_AUDIO_FORMAT_PCM_16K16BIT);
        asrRecogParams.setMaxSeconds("60");
        asrRecogParams.setAddPunc("yes");

        // ��ȡ�ֻ�������,�����ֻ�����������ѹ����ʽ
        int cpuCoreNum = getNumCores();
        if (cpuCoreNum > 1) {
            asrRecogParams.setEncode(HciCloudAsr.HCI_ASR_ENCODE_SPEEX);
        } else {
            asrRecogParams.setEncode(HciCloudAsr.HCI_ASR_ENCODE_ALAW);
        }
        
        mRecorderDialog.setParams(asrRecogParams);
    }
 
Example #22
Source File: ContainerTransformConfigurationHelper.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Show configuration chooser associated with a container transform from {@link
 * TransitionContainerTransformDemoFragment}.
 */
void showConfigurationChooser(Context context, @Nullable OnDismissListener onDismissListener) {
  BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(context);
  bottomSheetDialog.setContentView(
      createConfigurationBottomSheetView(context, bottomSheetDialog));
  bottomSheetDialog.setOnDismissListener(onDismissListener);
  bottomSheetDialog.show();
}
 
Example #23
Source File: LocationActivity.java    From VSigner with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initData() {
	initLocationClientOption();
	mLocationClient.start();
	refreshLocation();
	
	Intent intent = getIntent();
	Serializable serializable = intent.getSerializableExtra(Constants.CHANNEL_KEY);
	if(serializable != null && serializable instanceof Channel) {
		mChannel = (Channel) serializable;
	} else {
		ShowToast(getString(R.string.param_error));
		finish();
	}
	if(!mChannel.isActive()) {
		TipsDialog tipsDialog = new TipsDialog(mContext, getString(R.string.channel_is_not_active), getString(R.string.ok));
		tipsDialog.SetOnDismissListener(new OnDismissListener() {
				@Override
				public void onDismiss(DialogInterface arg0) {
					finish();
				}
			});
		tipsDialog.show();
	}
	
	mChannelNameTextView.setText(mChannel.getName());
}
 
Example #24
Source File: GuideActivity.java    From umeng_community_android with MIT License 5 votes vote down vote up
/**
 * 显示话题引导页面</br>
 */
private void showTopicFragment() {
    RecommendTopicFragment topicRecommendDialog =RecommendTopicFragment.newRecommendTopicFragment();
    topicRecommendDialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            showRecommendUserFragment();
        }
    });
    addFragment(mContainer, topicRecommendDialog);
}
 
Example #25
Source File: FindActivity.java    From umeng_community_android with MIT License 5 votes vote down vote up
/**
 * 显示推荐话题的Dialog</br>
 */
private void showRecommendTopic() {
    if (mRecommendTopicFragment == null) {
        mRecommendTopicFragment = RecommendTopicFragment.newRecommendTopicFragment();
        mRecommendTopicFragment.setSaveButtonInVisiable();
        mRecommendTopicFragment.setOnDismissListener(new OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
                showFindPage();
            }
        });
    }
    showCommFragment(mRecommendTopicFragment);
}
 
Example #26
Source File: MaterialAlertDialogBuilder.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public MaterialAlertDialogBuilder setOnDismissListener(
    @Nullable OnDismissListener onDismissListener) {
  return (MaterialAlertDialogBuilder) super.setOnDismissListener(onDismissListener);
}
 
Example #27
Source File: ContextMenuBuilder.java    From ticdesign with Apache License 2.0 4 votes vote down vote up
public void open() {

        mMenuDialog = new Builder(getContext(), R.style.Theme_Ticwear_Dialog_Alert_ContextMenu)
                .setCustomTitle(mHeaderView)
                .setTitle(mTitle)
                .setIcon(mIcon)
                .setOnDismissListener(new OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        close();
                    }
                })
                .create();

        // Use dialog context to match Ticwear theme.
        ViewGroup layout = createDialogContent(mMenuDialog.getContext());
        mMenuDialog.setView(layout);

        mMenuLayout.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(MenuItem item) {
                if (item != null) {
                    performItemAction(item);
                }
                close();
            }
        });

        onItemsChanged(true);

        final int maskColor = getResources().getColor(R.color.tic_background_mask_dark);
        final int animDurationLong = getResources().getInteger(android.R.integer.config_longAnimTime);

        mMenuDialog.setOnShowListener(new OnShowListener() {
            @Override
            public void onShow(DialogInterface di) {
                if (!isOpen() || mMenuDialog == null) {
                    return;
                }
                mMenuLayout.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (mMenuDialog == null) {
                            return;
                        }
                        BlurBehind.from(getContext())
                                .animate(animDurationLong)
                                .color(maskColor)
                                .sampling(2)
                                .capture(getBackgroundWindow())
                                .into(mMenuDialog.getWindow());
                    }
                }, 500);
            }
        });

        // Show dialog then blur.
        mMenuDialog.show();
        BlurBehind.from(getContext())
                .color(maskColor)
                .sampling(2)
                .capture(getBackgroundWindow())
                .into(mMenuDialog.getWindow());
    }
 
Example #28
Source File: PreferenceDialogBuilder.java    From MaterialPreference with Apache License 2.0 4 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public PreferenceDialogBuilder setOnDismissListener(OnDismissListener onDismissListener) {
    mBuilder.setOnDismissListener(onDismissListener);
    return this;
}
 
Example #29
Source File: PreferenceDialogBuilder.java    From MaterialPreference with Apache License 2.0 4 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public PreferenceDialogBuilder setOnDismissListener(OnDismissListener onDismissListener) {
    mBuilder.setOnDismissListener(onDismissListener);
    return this;
}
 
Example #30
Source File: ScaleImageView.java    From umeng_community_android with MIT License 4 votes vote down vote up
public void setOndismissListener(OnDismissListener listener) {
    mListener = listener;
}