use of android.support.v7.app.AlertDialog in project AndroidChromium by JackyAndroid.
the class PassphraseDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.sync_enter_passphrase, null);
TextView promptText = (TextView) v.findViewById(R.id.prompt_text);
promptText.setText(getPromptText());
TextView resetText = (TextView) v.findViewById(R.id.reset_text);
resetText.setText(getResetText());
resetText.setMovementMethod(LinkMovementMethod.getInstance());
resetText.setVisibility(View.VISIBLE);
mVerifyingTextView = (TextView) v.findViewById(R.id.verifying);
mPassphraseEditText = (EditText) v.findViewById(R.id.passphrase);
mPassphraseEditText.setHint(R.string.sync_enter_custom_passphrase_hint);
mPassphraseEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT) {
handleSubmit();
}
return false;
}
});
// Create a new background Drawable for the passphrase EditText to use when the user has
// entered an invalid potential password.
// https://crbug.com/602943 was caused by modifying the Drawable from getBackground()
// without taking a copy.
mOriginalBackground = mPassphraseEditText.getBackground();
mErrorBackground = mOriginalBackground.getConstantState().newDrawable();
mErrorBackground.mutate().setColorFilter(ApiCompatibilityUtils.getColor(getResources(), R.color.input_underline_error_color), PorterDuff.Mode.SRC_IN);
final AlertDialog d = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setView(v).setPositiveButton(R.string.submit, new Dialog.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
// We override the onclick. This is a hack to not dismiss the dialog after
// click of OK and instead dismiss it after confirming the passphrase
// is correct.
}
}).setNegativeButton(R.string.cancel, this).setTitle(R.string.sign_in_google_account).create();
d.getDelegate().setHandleNativeActionModesEnabled(false);
d.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button b = d.getButton(AlertDialog.BUTTON_POSITIVE);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handleSubmit();
}
});
}
});
return d;
}
use of android.support.v7.app.AlertDialog in project AndroidChromium by JackyAndroid.
the class AccessibilityUtil method showOldTalkbackVersionAlertOnce.
private static void showOldTalkbackVersionAlertOnce(final Context context) {
if (sOldTalkBackVersionAlertShown)
return;
sOldTalkBackVersionAlertShown = true;
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialogTheme).setTitle(R.string.old_talkback_title).setPositiveButton(R.string.update_from_market, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Uri marketUri = Uri.parse(TALKBACK_MARKET_LINK);
Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
context.startActivity(marketIntent);
}
}).setNegativeButton(R.string.cancel_talkback_alert, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// Do nothing, this alert is only shown once either way.
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
use of android.support.v7.app.AlertDialog in project AndroidDevelop by 7449.
the class SearchActivity method startDialog.
private void startDialog() {
List<SqlBean> fictionNameAll = GreenDaoDbUtils.getFictionNameAll();
View view = View.inflate(getApplicationContext(), R.layout.dialog_search, null);
editText = (EditText) view.findViewById(R.id.search_et);
final FlowLayout flowLayout = (FlowLayout) view.findViewById(R.id.flow);
flowLayout.removeAllViews();
alertDialog = new AlertDialog.Builder(this).setTitle(getString(R.string.fiction_name)).setView(view).setNegativeButton(getString(R.string.dialog_unok), null).setPositiveButton(getString(R.string.dialog_ok), this).create();
alertDialog.show();
for (int i = 0; i < fictionNameAll.size(); i++) {
FlowText textView = new FlowText(flowLayout.getContext());
textView.setText(fictionNameAll.get(i).getTitle());
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FlowText flowText = (FlowText) v;
fictionName = flowText.getText().toString().trim();
startNetWork();
alertDialog.dismiss();
}
});
flowLayout.addView(textView);
}
editText.setOnFocusChangeListener(this);
}
use of android.support.v7.app.AlertDialog in project AndroidDevelop by 7449.
the class VerifyFragment method getDialog.
@Override
public AlertDialog getDialog() {
mRootView = getRootView(R.layout.fragment_verify);
mAlertDialog = new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.dialog_verify_title) + SPUtils.getUserName()).setView(mRootView).create();
AppCompatButton button = getView(R.id.btn_register);
button.setOnClickListener(this);
button.setText(getString(R.string.dialog_verify_start));
getView(R.id.btn_cancel).setOnClickListener(this);
mPassWord = getView(R.id.et_pass_word);
return mAlertDialog;
}
use of android.support.v7.app.AlertDialog in project AntennaPod by AntennaPod.
the class PreferenceController method showNotificationButtonsDialog.
private void showNotificationButtonsDialog() {
final Context context = ui.getActivity();
final List<Integer> preferredButtons = UserPreferences.getCompactNotificationButtons();
final String[] allButtonNames = context.getResources().getStringArray(R.array.compact_notification_buttons_options);
// booleans default to false in java
boolean[] checked = new boolean[allButtonNames.length];
for (int i = 0; i < checked.length; i++) {
if (preferredButtons.contains(i)) {
checked[i] = true;
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(String.format(context.getResources().getString(R.string.pref_compact_notification_buttons_dialog_title), 2));
builder.setMultiChoiceItems(allButtonNames, checked, (dialog, which, isChecked) -> {
checked[which] = isChecked;
if (isChecked) {
if (preferredButtons.size() < 2) {
preferredButtons.add(which);
} else {
// Only allow a maximum of two selections. This is because the notification
// on the lock screen can only display 3 buttons, and the play/pause button
// is always included.
checked[which] = false;
ListView selectionView = ((AlertDialog) dialog).getListView();
selectionView.setItemChecked(which, false);
Snackbar.make(selectionView, String.format(context.getResources().getString(R.string.pref_compact_notification_buttons_dialog_error), 2), Snackbar.LENGTH_SHORT).show();
}
} else {
preferredButtons.remove((Integer) which);
}
});
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> UserPreferences.setCompactNotificationButtons(preferredButtons));
builder.setNegativeButton(R.string.cancel_label, null);
builder.create().show();
}
Aggregations