Java Code Examples for android.content.DialogInterface.OnDismissListener

The following are Jave code examples for showing how to use OnDismissListener of the android.content.DialogInterface class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: TripBuyer   File: MMAlert.java   Source Code and License Vote up 6 votes
public static AlertDialog showWebAlert(final Context context, final String title, final String rawUrl, final WebViewClient client, final String ok, final String cancel,
									   final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel, final DialogInterface.OnDismissListener lDismiss) {
	final View view = View.inflate(context, R.layout.webalert, null);
	final AlertDialog alert = showAlert(context, title, view, ok, cancel, lOk, lCancel);
	alert.setOnDismissListener(new DialogInterface.OnDismissListener() {

		@Override
		public void onDismiss(DialogInterface dialog) {
			if (lDismiss != null) {
				lDismiss.onDismiss(dialog);
			}
		}
	});

	final WebView info = (WebView) view.findViewById(R.id.info_wv);
	info.loadUrl(rawUrl);
	if (client != null) {
		info.setWebViewClient(client);
	}
	return alert;
}
 
Example 2
Project: Liteframework   File: DialogUtil.java   Source Code and License Vote up 5 votes
public static Dialog showTips(Context context, String title, String des, String btn, DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
Example 3
Project: KernelAdiutor-Mod   File: ViewUtils.java   Source Code and License Vote up 5 votes
public static Dialog dialogBuilder(CharSequence message, DialogInterface.OnClickListener negativeListener,
                                   DialogInterface.OnClickListener positiveListener,
                                   DialogInterface.OnDismissListener dismissListener, Context context) {
    Dialog dialog = new Dialog(context).setMessage(message);
    if (negativeListener != null) {
        dialog.setNegativeButton(context.getString(R.string.cancel), negativeListener);
    }
    if (positiveListener != null) {
        dialog.setPositiveButton(context.getString(R.string.ok), positiveListener);
    }
    if (dismissListener != null) {
        dialog.setOnDismissListener(dismissListener);
    }
    return dialog;
}
 
Example 4
Project: memetastic   File: ActivityUtils.java   Source Code and License Vote up 5 votes
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
    AppCompatTextView textView = new AppCompatTextView(_context);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
            _context.getResources().getDisplayMetrics());
    textView.setMovementMethod(new LinkMovementMethod());
    textView.setPadding(padding, 0, padding, 0);

    textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
    AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
            .setPositiveButton(android.R.string.ok, null)
            .setOnDismissListener(dismissedListener)
            .setTitle(resTitleId)
            .setView(textView);
    dialog.show();
}
 
Example 5
Project: Requirements   File: AlertDialogBuilder.java   Source Code and License Vote up 5 votes
public AlertDialogBuilder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    if (BuildUtils.isAtLeast(Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        super.setOnDismissListener(onDismissListener);
    } else {
        this.onDismissListener = onDismissListener;
    }
    return this;
}
 
Example 6
Project: quickhybrid-android   File: DialogUtil.java   Source Code and License Vote up 5 votes
/**
 * 确认对话框
 *
 * @param con
 * @param title           标题
 * @param titleGravity    标题对齐方式
 * @param message         提示内容
 * @param messageGravity  内容对齐方式
 * @param cancelable      返回键是否可取消
 * @param button1         按钮1名称
 * @param button2         按钮2名称
 * @param listener1       按钮1触发的事件
 * @param listener2       按钮2触发的事件
 * @param dismissListener 隐藏对话框触发的事件
 */
public static void showConfirmDialog(Context con, String title, int titleGravity, String message, int messageGravity, boolean cancelable, String button1,
                                     String button2, DialogInterface.OnClickListener listener1, DialogInterface.OnClickListener listener2, DialogInterface.OnDismissListener dismissListener) {
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    // 设置返回键是否退出
    builder.setCancelable(cancelable);
    //设置标题
    if (!TextUtils.isEmpty(title)) {
        builder.setTitle(title);
        if (titleGravity > 0) {
            builder.setTitleGravity(titleGravity);
        }
    }
    //设置提醒信息
    if (!TextUtils.isEmpty(message)) {
        builder.setMessage(message);
        if (messageGravity > 0) {
            builder.setMessageGravity(messageGravity);
        }
    }
    //设置右侧按钮
    if (!TextUtils.isEmpty(button1)) {
        builder.setPositiveButton(button1, listener1);
    }
    //设置左侧按钮
    if (!TextUtils.isEmpty(button2)) {
        builder.setNegativeButton(button2, listener2);
    }
    if (dismissListener != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            builder.setOnDismissListener(dismissListener);
        }
    }
    builder.create().show();
}
 
Example 7
Project: editor-sql   File: GoUtil.java   Source Code and License Vote up 5 votes
public static Dialog showTips(Context context, String title, String des, String btn,
                              DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
Example 8
Project: pius1   File: MaterialDialog.java   Source Code and License Vote up 4 votes
public MaterialDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener)
{
    this.mOnDismissListener = onDismissListener;
    return this;
}
 
Example 9
Project: CompatAlertDialog   File: AlertDialog.java   Source Code and License Vote up 4 votes
public Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    builder.setOnDismissListener(onDismissListener);
    return this;
}
 
Example 10
Project: keepass2android   File: Dlg.java   Source Code and License Vote up 4 votes
/**
 * Shows an info dialog.
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            the message.
 * @param listener
 *            the {@link DialogInterface.OnDismissListener}.
 */
public static void showInfo(Context context, CharSequence msg,
        DialogInterface.OnDismissListener listener) {
    AlertDialog dlg = newAlertDlg(context);
    dlg.setIcon(android.R.drawable.ic_dialog_info);
    dlg.setTitle(R.string.afc_title_info);
    dlg.setMessage(msg);
    dlg.setOnDismissListener(listener);
    dlg.show();
}
 
Example 11
Project: Phoenix-for-VK   File: InputTextDialog.java   Source Code and License Vote up 4 votes
public Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    this.onDismissListener = onDismissListener;
    return this;
}
 
Example 12
Project: AssistantBySDK   File: TimePickerDialog.java   Source Code and License Vote up 4 votes
@SuppressWarnings("unused")
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
}
 
Example 13
Project: aos-Video   File: TraktSigninDialogPreference.java   Source Code and License Vote up 4 votes
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener){
    mOnDismissListener = onDismissListener;
}
 
Example 14
Project: quickhybrid-android   File: DialogUtil.java   Source Code and License Vote up 4 votes
public static void showConfirmDialog(Context con, String title, String message, boolean cancelable, String button1,
                                     String button2, DialogInterface.OnClickListener listener1, DialogInterface.OnClickListener listener2, DialogInterface.OnDismissListener dismissListener) {
    showConfirmDialog(con, title, 0, message, 0, cancelable, button1, button2, listener1, listener2, dismissListener);
}
 
Example 15
Project: Liteframework   File: DialogUtil.java   Source Code and License Vote up 4 votes
public static Dialog showTips(Context context, int title, int des, int btn, DialogInterface.OnDismissListener dismissListener) {
    return showTips(context, context.getString(title), context.getString(des), context.getString(btn), dismissListener);
}
 
Example 16
Project: AndroidOpen   File: BottomPopup.java   Source Code and License Vote up 2 votes
/**
 * Sets on dismiss listener.
 *
 * @param onDismissListener the on dismiss listener
 */
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    popup.setOnDismissListener(onDismissListener);
}
 
Example 17
Project: MainCalendar   File: Popup.java   Source Code and License Vote up 2 votes
/**
 * Sets on dismiss listener.
 *
 * @param onDismissListener the on dismiss listener
 */
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    dialog.setOnDismissListener(onDismissListener);
}
 
Example 18
Project: keepass2android   File: Dlg.java   Source Code and License Vote up 2 votes
/**
 * Shows an info dialog.
 * 
 * @param context
 *            the context.
 * @param msgId
 *            the resource ID of the message.
 * @param listener
 *            the {@link DialogInterface.OnDismissListener}.
 */
public static void showInfo(Context context, int msgId,
        DialogInterface.OnDismissListener listener) {
    showInfo(context, context.getString(msgId), listener);
}
 
Example 19
Project: MainCalendar   File: BottomPopup.java   Source Code and License Vote up 2 votes
/**
 * Sets on dismiss listener.
 *
 * @param onDismissListener the on dismiss listener
 */
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    popup.setOnDismissListener(onDismissListener);
    LogUtils.debug("popup setOnDismissListener");
}
 
Example 20
Project: quickhybrid-android   File: QuickDialog.java   Source Code and License Vote up 2 votes
/**
 * 设置取消监听
 *
 * @param dismissListener
 * @return
 */
public Builder setOnDismissListener(DialogInterface.OnDismissListener dismissListener) {
    this.dismissListener = dismissListener;
    return this;
}