Java Code Examples for android.content.DialogInterface.OnDismissListener

The following examples show how to use android.content.DialogInterface.OnDismissListener. These examples are extracted from open source projects. 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 Project: FimiX8-RE   Source File: X8TLRDialogManager.java    License: 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 2
Source Project: FimiX8-RE   Source File: X8TLRDialogManager.java    License: 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 3
Source Project: FimiX8-RE   Source File: X8TLRDialogManager.java    License: 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 4
Source Project: apollo-DuerOS   Source File: CarlifeActivity.java    License: 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 5
Source Project: apollo-DuerOS   Source File: CarlifeActivity.java    License: 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 6
Source Project: LibreTasks   Source File: ActivityDlgActionInput.java    License: 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 7
@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 8
Source Project: PdDroidPublisher   Source File: Numberbox.java    License: 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 9
Source Project: PdDroidPublisher   Source File: Symbol.java    License: 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 10
Source Project: freeiot-android   Source File: CommonUtils.java    License: 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 11
Source Project: M3UPlayer   Source File: Player.java    License: 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 12
@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 13
Source Project: barterli_android   Source File: AlertDialogFragment.java    License: 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 14
@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 15
@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 16
@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 17
/**
 * 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 18
Source Project: open-rmbt   Source File: RMBTTestFragment.java    License: 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 19
/**
 * 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 20
/**
 * 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 21
Source Project: umeng_community_android   Source File: FindActivity.java    License: 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 22
Source Project: umeng_community_android   Source File: GuideActivity.java    License: 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 23
Source Project: VSigner   Source File: LocationActivity.java    License: 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 Project: freeiot-android   Source File: LoginActivity.java    License: 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 25
Source Project: sinovoice-pathfinder   Source File: CandidateView.java    License: 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 26
public void setOnDismissListener(@Nullable OnDismissListener onDismissListener) {
  mOnDismissListener = onDismissListener;
}
 
Example 27
Source Project: react-native-GPay   Source File: TimePickerDialogFragment.java    License: MIT License 4 votes vote down vote up
public void setOnDismissListener(@Nullable OnDismissListener onDismissListener) {
  mOnDismissListener = onDismissListener;
}
 
Example 28
void setOnDismissListener(@Nullable OnDismissListener onDismissListener) {
  mOnDismissListener = onDismissListener;
}
 
Example 29
Source Project: react-native-GPay   Source File: DatePickerDialogFragment.java    License: MIT License 4 votes vote down vote up
void setOnDismissListener(@Nullable OnDismissListener onDismissListener) {
  mOnDismissListener = onDismissListener;
}
 
Example 30
@NonNull
@Override
public MaterialAlertDialogBuilder setOnDismissListener(
    @Nullable OnDismissListener onDismissListener) {
  return (MaterialAlertDialogBuilder) super.setOnDismissListener(onDismissListener);
}