Java Code Examples for android.support.v7.app.AlertDialog.Builder#setTitle()

The following examples show how to use android.support.v7.app.AlertDialog.Builder#setTitle() . 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: DialogFactory.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
public static void createAndShowDialog(Context context, String title, String content,
                                       String negativeButtonTip, DialogInterface.OnClickListener negativeListener,
                                       String positiveButtonTip, DialogInterface.OnClickListener positiveListener) {
    Builder builder = new Builder(context);
    builder.setTitle(title);
    builder.setMessage(content);
    builder.setNegativeButton(negativeButtonTip, negativeListener);
    builder.setPositiveButton(positiveButtonTip, positiveListener);
    builder.show();
}
 
Example 2
Source File: DialogFactory.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
public static EditText showInputDialog(Context context, String title, String content, DialogInterface.OnClickListener positiveListener) {
    Builder builder = new Builder(context);
    builder.setTitle(title);
    builder.setMessage(content);
    AppCompatEditText input = new AppCompatEditText(context);
    builder.setView(input, PADDING, PADDING, PADDING, PADDING);
    builder.setNegativeButton(CANCEL_TIP, null);
    builder.setPositiveButton(SURE_TIP, positiveListener);
    builder.show();
    return input;
}
 
Example 3
Source File: DialogFactory.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
public static void showInputDialog(Context context, String title, View contentView, DialogInterface.OnClickListener positiveListener) {
    Builder builder = new Builder(context);
    builder.setTitle(title);
    builder.setMessage(null);
    builder.setView(contentView, 3 * PADDING, PADDING, 3 * PADDING, PADDING);
    builder.setNegativeButton(QuickNote.getString(R.string.popup_window_cancel), null);
    builder.setPositiveButton(QuickNote.getString(R.string.popup_window_sure), positiveListener);
    builder.show();
}
 
Example 4
Source File: EditAccountActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
public void showWipePepDialog() {
    Builder builder = new Builder(this);
    builder.setTitle(getString(R.string.clear_other_devices));
    builder.setIconAttribute(android.R.attr.alertDialogIcon);
    builder.setMessage(getString(R.string.clear_other_devices_desc));
    builder.setNegativeButton(getString(R.string.cancel), null);
    builder.setPositiveButton(getString(R.string.accept),
            (dialog, which) -> mAccount.getAxolotlService().wipeOtherPepDevices());
    builder.create().show();
}
 
Example 5
Source File: XmppActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
public void showInstallPgpDialog() {
    Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.openkeychain_required));
    builder.setIconAttribute(android.R.attr.alertDialogIcon);
    builder.setMessage(getText(R.string.openkeychain_required_long));
    builder.setNegativeButton(getString(R.string.cancel), null);
    builder.setNeutralButton(getString(R.string.restart),
            (dialog, which) -> {
                if (xmppConnectionServiceBound) {
                    unbindService(mConnection);
                    xmppConnectionServiceBound = false;
                }
                stopService(new Intent(XmppActivity.this,
                        XmppConnectionService.class));
                finish();
            });
    builder.setPositiveButton(getString(R.string.install),
            (dialog, which) -> {
                Uri uri = Uri
                        .parse("market://details?id=org.sufficientlysecure.keychain");
                Intent marketIntent = new Intent(Intent.ACTION_VIEW,
                        uri);
                PackageManager manager = getApplicationContext()
                        .getPackageManager();
                List<ResolveInfo> infos = manager
                        .queryIntentActivities(marketIntent, 0);
                if (infos.size() > 0) {
                    startActivity(marketIntent);
                } else {
                    uri = Uri.parse("http://www.openkeychain.org/");
                    Intent browserIntent = new Intent(
                            Intent.ACTION_VIEW, uri);
                    startActivity(browserIntent);
                }
                finish();
            });
    builder.create().show();
}