Search in sources :

Example 41 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project Signal-Android by WhisperSystems.

the class WebRtcCallActivity method handleNoSuchUser.

private void handleNoSuchUser(@NonNull final WebRtcViewModel event) {
    // XXX Stuart added this check above, not sure why, so I'm repeating in ignorance. - moxie
    if (isFinishing())
        return;
    AlertDialog.Builder dialog = new AlertDialog.Builder(this);
    dialog.setTitle(R.string.RedPhone_number_not_registered);
    dialog.setIconAttribute(R.attr.dialog_alert_icon);
    dialog.setMessage(R.string.RedPhone_the_number_you_dialed_does_not_support_secure_voice);
    dialog.setCancelable(true);
    dialog.setPositiveButton(R.string.RedPhone_got_it, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            WebRtcCallActivity.this.handleTerminate(event.getRecipient());
        }
    });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            WebRtcCallActivity.this.handleTerminate(event.getRecipient());
        }
    });
    dialog.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 42 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project KJFrameForAndroid by kymjs.

the class ViewInject method getExitDialog.

/**
     * 返回一个退出确认对话框
     */
public void getExitDialog(final Context context, String title, OnClickListener l) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(title);
    builder.setCancelable(false);
    builder.setNegativeButton("取消", new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.setPositiveButton("确定", l);
    builder.create();
    builder.show();
    builder = null;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 43 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project k-9 by k9mail.

the class CryptoSettingsDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle arguments = savedInstanceState != null ? savedInstanceState : getArguments();
    currentMode = CryptoMode.valueOf(arguments.getString(ARG_CURRENT_MODE));
    @SuppressLint("InflateParams") View view = LayoutInflater.from(getActivity()).inflate(R.layout.crypto_settings_dialog, null);
    cryptoModeSelector = (CryptoModeSelector) view.findViewById(R.id.crypto_status_selector);
    cryptoStatusText = (LinearViewAnimator) view.findViewById(R.id.crypto_status_text);
    cryptoModeSelector.setCryptoStatusListener(this);
    updateView(false);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(view);
    builder.setNegativeButton(R.string.crypto_settings_cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int i) {
            dialog.dismiss();
        }
    });
    builder.setPositiveButton(R.string.crypto_settings_ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            changeCryptoSettings();
            dialog.dismiss();
        }
    });
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Bundle(android.os.Bundle) SuppressLint(android.annotation.SuppressLint) OnClickListener(android.content.DialogInterface.OnClickListener) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 44 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project k-9 by k9mail.

the class PgpInlineDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Activity activity = getActivity();
    @SuppressLint("InflateParams") View view = LayoutInflater.from(activity).inflate(R.layout.openpgp_inline_dialog, null);
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setView(view);
    if (getArguments().getInt(ARG_FIRST_TIME) != 0) {
        builder.setPositiveButton(R.string.openpgp_inline_ok, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    } else {
        builder.setPositiveButton(R.string.openpgp_inline_disable, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Activity activity = getActivity();
                if (activity == null) {
                    return;
                }
                ((OnOpenPgpInlineChangeListener) activity).onOpenPgpInlineChange(false);
                dialog.dismiss();
            }
        });
        builder.setNegativeButton(R.string.openpgp_inline_keep_enabled, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    }
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SuppressLint(android.annotation.SuppressLint) OnClickListener(android.content.DialogInterface.OnClickListener) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 45 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project android_frameworks_base by ParanoidAndroid.

the class QuickSettings method showBugreportDialog.

private void showBugreportDialog() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                // Add a little delay before executing, to give the
                // dialog a chance to go away before it takes a
                // screenshot.
                mHandler.postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            ActivityManagerNative.getDefault().requestBugReport();
                        } catch (RemoteException e) {
                        }
                    }
                }, 500);
            }
        }
    });
    builder.setMessage(com.android.internal.R.string.bugreport_message);
    builder.setTitle(com.android.internal.R.string.bugreport_title);
    builder.setCancelable(true);
    final Dialog dialog = builder.create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    try {
        WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
    } catch (RemoteException e) {
    }
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) OnClickListener(android.content.DialogInterface.OnClickListener) RemoteException(android.os.RemoteException)

Aggregations

DialogInterface (android.content.DialogInterface)186 OnClickListener (android.content.DialogInterface.OnClickListener)186 AlertDialog (android.app.AlertDialog)122 View (android.view.View)49 TextView (android.widget.TextView)39 SuppressLint (android.annotation.SuppressLint)37 Intent (android.content.Intent)35 Context (android.content.Context)24 EditText (android.widget.EditText)22 Bundle (android.os.Bundle)21 LayoutInflater (android.view.LayoutInflater)18 Builder (android.app.AlertDialog.Builder)15 Paint (android.graphics.Paint)15 OnCancelListener (android.content.DialogInterface.OnCancelListener)14 KeyEvent (android.view.KeyEvent)12 CompoundButton (android.widget.CompoundButton)12 Point (android.graphics.Point)11 AlertDialog (android.support.v7.app.AlertDialog)11 ContextThemeWrapper (android.view.ContextThemeWrapper)11 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)11