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();
}
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;
}
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();
});
}
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;
}
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();
}
}
Aggregations