Search in sources :

Example 66 with Builder

use of android.app.AlertDialog.Builder in project Conversations by siacs.

the class XmppActivity method quickEdit.

@SuppressLint("InflateParams")
private void quickEdit(final String previousValue, final OnValueEdited callback, final int hint, boolean password) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.quickedit, null);
    final EditText editor = (EditText) view.findViewById(R.id.editor);
    OnClickListener mClickListener = new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String value = editor.getText().toString();
            if (!value.equals(previousValue) && value.trim().length() > 0) {
                callback.onValueEdited(value);
            }
        }
    };
    if (password) {
        editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        builder.setPositiveButton(R.string.accept, mClickListener);
    } else {
        builder.setPositiveButton(R.string.edit, mClickListener);
    }
    if (hint != 0) {
        editor.setHint(hint);
    }
    editor.requestFocus();
    editor.setText("");
    if (previousValue != null) {
        editor.getText().append(previousValue);
    }
    builder.setView(view);
    builder.setNegativeButton(R.string.cancel, null);
    builder.create().show();
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder) OnClickListener(android.content.DialogInterface.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 67 with Builder

use of android.app.AlertDialog.Builder in project Conversations by siacs.

the class XmppActivity method showAskForPresenceDialog.

private void showAskForPresenceDialog(final Contact contact) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(contact.getJid().toString());
    builder.setMessage(R.string.request_presence_updates);
    builder.setNegativeButton(R.string.cancel, null);
    builder.setPositiveButton(R.string.request_now, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (xmppConnectionServiceBound) {
                xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().requestPresenceUpdatesFrom(contact));
            }
        }
    });
    builder.create().show();
}
Also used : AlertDialog(android.app.AlertDialog) OnClickListener(android.content.DialogInterface.OnClickListener) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 68 with Builder

use of android.app.AlertDialog.Builder in project ignition by mttkay.

the class IgnitedLocationSupport method buildWaitForLocationDialog.

/**
     * Creates a builder for the wait for location dialog. By default dismissing the dialog will
     * finish the {@link Activity} that created it.
     * 
     * @param context
     * @return a builder for the wait for location dialog
     */
public static Builder buildWaitForLocationDialog(final Context context) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            ((Activity) context).finish();
        }
    });
    builder.setMessage(context.getString(R.string.ign_loc_dialog_wait_for_fix));
    return builder;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder)

Example 69 with Builder

use of android.app.AlertDialog.Builder in project ignition by mttkay.

the class IgnitedLocationSupport method createNoProvidersEnabledDialog.

public static Builder createNoProvidersEnabledDialog(final Activity activity, final boolean finishActivityOnDismiss) {
    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                Intent intent = new Intent();
                intent.setAction(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                activity.startActivity(intent);
            } else {
                dialog.cancel();
                if (finishActivityOnDismiss) {
                    activity.finish();
                }
            }
        }
    };
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setPositiveButton(R.string.ign_loc_dialog_location_unavailable_change_settings, listener);
    builder.setNegativeButton(android.R.string.no, listener);
    builder.setCancelable(false);
    builder.setTitle(R.string.ign_loc_dialog_location_unavailable_title);
    builder.setMessage(R.string.ign_loc_dialog_location_unavailable_message);
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    return builder;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder) Intent(android.content.Intent)

Example 70 with Builder

use of android.app.AlertDialog.Builder in project ignition by mttkay.

the class IgnitedDialogs method newMessageDialog.

/**
     * Builds a new AlertDialog to display a simple message
     * 
     * @param context
     * @param title
     * @param message
     * @param iconId
     * @return
     */
public static AlertDialog.Builder newMessageDialog(final Context context, String title, String message, int iconId) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);
    builder.setPositiveButton(context.getString(android.R.string.ok), new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setIcon(iconId);
    return builder;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder) OnClickListener(android.content.DialogInterface.OnClickListener)

Aggregations

Builder (android.app.AlertDialog.Builder)112 DialogInterface (android.content.DialogInterface)64 AlertDialog (android.app.AlertDialog)42 Intent (android.content.Intent)29 View (android.view.View)28 TextView (android.widget.TextView)25 OnClickListener (android.content.DialogInterface.OnClickListener)21 SuppressLint (android.annotation.SuppressLint)16 ArrayList (java.util.ArrayList)15 OnClickListener (android.view.View.OnClickListener)13 ImageView (android.widget.ImageView)13 Context (android.content.Context)12 AlertDialog (android.support.v7.app.AlertDialog)12 List (java.util.List)12 Bundle (android.os.Bundle)11 RelativeLayout (android.widget.RelativeLayout)10 Point (android.graphics.Point)9 ExpandableListView (android.widget.ExpandableListView)9 ImageButton (android.widget.ImageButton)7 EditText (android.widget.EditText)6