Search in sources :

Example 66 with DialogInterface

use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.

the class ItemChooserDialog method showDialogForView.

private void showDialogForView(View view) {
    mDialog = new Dialog(mActivity) {

        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            super.onWindowFocusChanged(hasFocus);
            if (!hasFocus)
                super.dismiss();
        }
    };
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            mItemSelectedCallback.onItemSelected("");
        }
    });
    Window window = mDialog.getWindow();
    if (!DeviceFormFactor.isTablet(mActivity)) {
        // On smaller screens, make the dialog fill the width of the screen,
        // and appear at the top.
        window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
        window.setGravity(Gravity.TOP);
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    mDialog.show();
}
Also used : Window(android.view.Window) ColorDrawable(android.graphics.drawable.ColorDrawable) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) LinearLayout(android.widget.LinearLayout)

Example 67 with DialogInterface

use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.

the class RepostFormWarningDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setMessage(R.string.http_post_warning);
    if (savedInstanceState == null) {
        assert mTab != null;
        builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int id) {
                if (!mTab.isInitialized())
                    return;
                mTab.getWebContents().getNavigationController().cancelPendingReload();
            }
        });
        builder.setPositiveButton(R.string.http_post_warning_resend, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int id) {
                if (!mTab.isInitialized())
                    return;
                mTab.getWebContents().getNavigationController().continuePendingReload();
            }
        });
    }
    Dialog dialog = builder.create();
    setCurrentDialogForTesting(dialog);
    return dialog;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) AlertDialog(android.support.v7.app.AlertDialog) Dialog(android.app.Dialog) SuppressLint(android.annotation.SuppressLint)

Example 68 with DialogInterface

use of android.content.DialogInterface 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 69 with DialogInterface

use of android.content.DialogInterface 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 70 with DialogInterface

use of android.content.DialogInterface in project UltimateAndroid by cymcsg.

the class TeamList method addTeamButtonListener.

protected DialogInterface.OnClickListener addTeamButtonListener() {
    return new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            EditText collectedTextView = (EditText) getTextEntryView().findViewById(R.id.collected_text);
            String name = collectedTextView.getText().toString();
            Team.create(name, TeamList.this);
            teamListAdapter.add(name);
        }
    };
}
Also used : EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface)

Aggregations

DialogInterface (android.content.DialogInterface)2727 AlertDialog (android.app.AlertDialog)1227 View (android.view.View)877 Intent (android.content.Intent)708 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)644 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Dialog (android.app.Dialog)179 Context (android.content.Context)179 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143