Search in sources :

Example 6 with AlertDialog

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;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) View(android.view.View) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.content.DialogInterface.OnClickListener) TextView(android.widget.TextView) OnEditorActionListener(android.widget.TextView.OnEditorActionListener)

Example 7 with AlertDialog

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) Uri(android.net.Uri)

Example 8 with AlertDialog

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);
}
Also used : FlowLayout(org.apmem.tools.layouts.FlowLayout) SqlBean(framework.db.SqlBean) FlowText(framework.widget.FlowText) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) SearchView(com.fiction.y.search.v.SearchView)

Example 9 with AlertDialog

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;
}
Also used : AppCompatButton(android.support.v7.widget.AppCompatButton)

Example 10 with AlertDialog

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();
}
Also used : Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint)

Aggregations

AlertDialog (android.support.v7.app.AlertDialog)413 DialogInterface (android.content.DialogInterface)275 View (android.view.View)219 TextView (android.widget.TextView)165 Intent (android.content.Intent)117 EditText (android.widget.EditText)87 ImageView (android.widget.ImageView)68 Button (android.widget.Button)67 LayoutInflater (android.view.LayoutInflater)59 RecyclerView (android.support.v7.widget.RecyclerView)54 NonNull (android.support.annotation.NonNull)53 AdapterView (android.widget.AdapterView)51 SuppressLint (android.annotation.SuppressLint)50 ArrayList (java.util.ArrayList)48 Bundle (android.os.Bundle)46 ListView (android.widget.ListView)42 Context (android.content.Context)35 SharedPreferences (android.content.SharedPreferences)35 Uri (android.net.Uri)32 LinearLayout (android.widget.LinearLayout)29