Example usage for android.content DialogInterface BUTTON_NEGATIVE

List of usage examples for android.content DialogInterface BUTTON_NEGATIVE

Introduction

In this page you can find the example usage for android.content DialogInterface BUTTON_NEGATIVE.

Prototype

int BUTTON_NEGATIVE

To view the source code for android.content DialogInterface BUTTON_NEGATIVE.

Click Source Link

Document

The identifier for the negative button.

Usage

From source file:se.ottomatech.marcusjacobsson.eaglenote.dialogfragments.DialogFragmentLicenseFailed.java

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_NEGATIVE:
        dialog.dismiss();//from  w  w w  . j  a  va  2  s.  c o  m
        getActivity().finish();
        break;

    case DialogInterface.BUTTON_POSITIVE:
        getActivity().finish();
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                "http://www.https://play.google.com/store/apps/details?id=se.ottomatech.marcusjacobsson.eaglenote.pro"));
        startActivity(intent);
        break;

    }
}

From source file:se.ottomatech.marcusjacobsson.eaglenote.dialogfragments.DialogFragmentLicenseRetry.java

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_NEGATIVE:
        dialog.dismiss();//  w  w w  .  java  2 s.com
        getActivity().finish();
        break;

    case DialogInterface.BUTTON_POSITIVE:
        mListener.onLicenceRetryPositiveClick();
        dialog.dismiss();
        break;
    }
}

From source file:com.ilearnrw.reader.tasks.ProfileTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(context);
    dialog.setTitle(context.getString(R.string.dialog_fetch_user_profile_title));
    dialog.setMessage(context.getString(R.string.dialog_fetch_user_profile_summary));
    dialog.setCancelable(true);// w ww  .  j  a v  a  2  s.  c  o  m
    dialog.setCanceledOnTouchOutside(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    cancel(true);
                    dialog.dismiss();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
            dialog.dismiss();
        }
    });
    dialog.show();

    super.onPreExecute();
}

From source file:com.ilearnrw.reader.tasks.LoginTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(context);
    dialog.setTitle(context.getString(R.string.dialog_login_title));
    dialog.setMessage(context.getString(R.string.dialog_login_message));
    dialog.setCancelable(true);/*from w w  w  .j  av  a 2s  .c  om*/
    dialog.setCanceledOnTouchOutside(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    cancel(true);
                    dialog.dismiss();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
            dialog.dismiss();
        }
    });
    dialog.show();
    super.onPreExecute();
}

From source file:com.ilearnrw.reader.tasks.UserDetailsTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(context);
    dialog.setTitle(context.getString(R.string.dialog_fetch_user_title));
    dialog.setMessage(context.getString(R.string.dialog_fetch_user_message));
    dialog.setCancelable(true);//from   w w  w  .  ja v  a2 s.c o  m
    dialog.setCanceledOnTouchOutside(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    cancel(true);
                    dialog.dismiss();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
            dialog.dismiss();
        }
    });
    dialog.show();
    super.onPreExecute();
}

From source file:rikka.materialpreference.PreferenceDialogFragment.java

@Override
public @NonNull Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    mWhichButtonClicked = DialogInterface.BUTTON_NEGATIVE;

    final AlertDialog.Builder builder = new AlertDialog.Builder(context).setTitle(mPreference.getDialogTitle())
            .setIcon(mPreference.getDialogIcon()).setPositiveButton(mPreference.getPositiveButtonText(), this)
            .setNegativeButton(mPreference.getNegativeButtonText(), this);

    View contentView = onCreateDialogView(context);
    if (contentView != null) {
        onBindDialogView(contentView);/*from   w ww.  ja  va2  s .co  m*/
        builder.setView(contentView);
    } else {
        builder.setMessage(mPreference.getDialogMessage());
    }

    onPrepareDialogBuilder(builder);

    // Create the dialog
    final Dialog dialog = builder.create();
    if (needInputMethod()) {
        requestInputMethod(dialog);
    }

    return builder.create();
}

From source file:org.mobisocial.corral.BackgroundableDownloadDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog d = new ProgressDialog(getActivity());
    d.setTitle("Fetching file");
    d.setMessage("Preparing to download...");
    d.setIndeterminate(true);/*from  www . j ava 2  s  .co  m*/
    d.setCancelable(true);
    d.setButton(DialogInterface.BUTTON_POSITIVE, "Background", mBackgroundListener);
    d.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", mCancelListener);
    return d;
}

From source file:com.esminis.server.library.dialog.about.AboutViewImpl.java

public AboutViewImpl(Context context, AboutPresenter presenter) {
    super(context, presenter);
    final LayoutInflater inflater = LayoutInflater.from(context);
    final ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.dialog_about, null);
    final TabHost tabhost = (TabHost) layout.findViewById(R.id.tabhost);
    tabhost.setup();//  w w w. j  av a  2s.c o m
    addTab(tabhost, context, R.string.manual, viewTextManual = createText(inflater, layout));
    addTab(tabhost, context, R.string.about, viewTextAbout = createText(inflater, layout));
    addTab(tabhost, context, R.string.licenses, viewLicenses = new ProductLicensesViewer(context));
    setupTabTitles(tabhost);
    setView(layout);
    setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.close), (Message) null);
}

From source file:com.itcorea.coreonwallet.DatePickerDialogFragment.java

@TargetApi(11)
@Override//from   w  w w .ja va 2 s.co m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle b = getArguments();
    int y = b.getInt(YEAR);
    int m = b.getInt(MONTH);
    int d = b.getInt(DATE);

    final DatePickerDialog picker = new DatePickerDialog(getActivity(), getConstructorListener(), y, m, d);

    if (hasJellyBeanAndAbove()) {
        picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        DatePicker dp = picker.getDatePicker();
                        mListener.onDateSet(dp, dp.getYear(), dp.getMonth(), dp.getDayOfMonth());
                    }
                });
        picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(android.R.string.cancel),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
    }
    return picker;
}

From source file:com.hyperaware.conference.android.fragment.SigninRequiredDialogFragment.java

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        host.signIn();/*from  w  w w .  j  a  v a2  s  .c  om*/
        break;
    case DialogInterface.BUTTON_NEGATIVE:
        dismiss();
        break;
    default:
        break;
    }
}