Search in sources :

Example 86 with Builder

use of android.app.AlertDialog.Builder in project AndFrameWorks by scwang90.

the class AfDialogBuilder method selectItem.

/**
 * 显示一个单选对话框
 *
 * @param title    对话框标题
 * @param items    选择菜单项
 * @param listener 选择监听器
 * @param oncancel 取消选择监听器
 */
@Override
public Dialog selectItem(CharSequence title, CharSequence[] items, OnClickListener listener, final OnCancelListener oncancel) {
    Builder dialog = new Builder(mContext);
    if (title != null) {
        dialog.setTitle(title);
        if (oncancel != null) {
            dialog.setNegativeButton("取消", new SafeListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    oncancel.onCancel(dialog);
                }
            });
        }
    }
    if (oncancel != null) {
        dialog.setCancelable(true);
        dialog.setOnCancelListener(new SafeListener(oncancel));
    } else {
        dialog.setCancelable(false);
    }
    dialog.setItems(items, new SafeListener(listener));
    return dialog.show();
}
Also used : DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) DialogBuilder(com.andframe.api.DialogBuilder) SafeListener(com.andframe.listener.SafeListener) SuppressLint(android.annotation.SuppressLint)

Example 87 with Builder

use of android.app.AlertDialog.Builder in project android_packages_apps_Settings by omnirom.

the class ChooseLockTypeDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getContext();
    Builder builder = new Builder(context);
    List<ScreenLockType> locks = mController.getVisibleScreenLockTypes(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
    mAdapter = new ScreenLockAdapter(context, locks, mController);
    builder.setAdapter(mAdapter, this);
    builder.setTitle(R.string.setup_lock_settings_options_dialog_title);
    AlertDialog alertDialog = builder.create();
    return alertDialog;
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) Builder(android.app.AlertDialog.Builder)

Example 88 with Builder

use of android.app.AlertDialog.Builder in project AppCoins-ethereumj by AppStoreFoundation.

the class PaymentService method showWalletInstallDialog.

private Single<Boolean> showWalletInstallDialog(Context context) {
    return Single.create(emitter -> {
        Builder builder;
        builder = new Builder(context);
        builder.setTitle("APPC Wallet Missing").setMessage("To complete your purchase, you have to install an AppCoins wallet").setPositiveButton(string.yes, (dialog, which) -> emitter.onSuccess(true)).setNegativeButton(string.no, (dialog, which) -> emitter.onSuccess(false)).setIcon(drawable.ic_dialog_alert).show();
    });
}
Also used : R.string(android.R.string) Builder(android.app.AlertDialog.Builder) Context(android.content.Context) SkuManager(com.asf.appcoins.sdk.iab.SkuManager) Uri(android.net.Uri) Intent(android.content.Intent) HashMap(java.util.HashMap) NonNull(android.support.annotation.NonNull) Status(com.asf.appcoins.sdk.iab.entity.Transaction.Status) SKU(com.asf.appcoins.sdk.iab.entity.SKU) UriBuilder(com.asf.appcoins.sdk.iab.util.UriBuilder) Single(io.reactivex.Single) Consumer(io.reactivex.functions.Consumer) BigDecimal(java.math.BigDecimal) Disposable(io.reactivex.disposables.Disposable) Map(java.util.Map) Transaction(com.asf.appcoins.sdk.iab.entity.Transaction) AndroidUtils(com.asf.appcoins.sdk.iab.wallet.AndroidUtils) Observable(io.reactivex.Observable) AsfWeb3j(com.asf.appcoins.sdk.iab.AsfWeb3j) Activity(android.app.Activity) R.drawable(android.R.drawable) Builder(android.app.AlertDialog.Builder) UriBuilder(com.asf.appcoins.sdk.iab.util.UriBuilder)

Example 89 with Builder

use of android.app.AlertDialog.Builder in project android_packages_apps_Settings by DirtyUnicorns.

the class ChooseLockTypeDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getContext();
    Builder builder = new Builder(context);
    List<ScreenLockType> locks = mController.getVisibleScreenLockTypes(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
    mAdapter = new ScreenLockAdapter(context, locks, mController);
    builder.setAdapter(mAdapter, this);
    builder.setTitle(R.string.setup_lock_settings_options_dialog_title);
    AlertDialog alertDialog = builder.create();
    return alertDialog;
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) Builder(android.app.AlertDialog.Builder)

Example 90 with Builder

use of android.app.AlertDialog.Builder in project remote-desktop-clients by iiordanov.

the class MessageDialogs method displayDialog.

/**
 * Displays a generic dialog.
 *
 * @param context
 * @param alertTitle
 * @param alert
 * @param ok
 */
private static void displayDialog(final Context context, int alertTitleID, int alertID, String appendText, DialogInterface.OnClickListener ok) {
    boolean show = true;
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (activity.isFinishing()) {
            show = false;
        }
    }
    if (show) {
        Builder builder = new Builder((Activity) context);
        builder.setCancelable(false);
        builder.setTitle(alertTitleID);
        String displayText = context.getString(alertID);
        if (appendText != null) {
            displayText = displayText + " " + appendText;
        }
        Spanned text = Html.fromHtml(displayText);
        final TextView message = new TextView(context);
        message.setText(text);
        message.setMovementMethod(LinkMovementMethod.getInstance());
        message.setPaddingRelative(50, 50, 50, 50);
        builder.setView(message);
        builder.setPositiveButton("OK", ok);
        builder.show();
    }
}
Also used : Builder(android.app.AlertDialog.Builder) Activity(android.app.Activity) TextView(android.widget.TextView) SpannableString(android.text.SpannableString) Spanned(android.text.Spanned)

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