Java Code Examples for android.content.DialogInterface.BUTTON_NEUTRAL

The following are Jave code examples for showing how to use BUTTON_NEUTRAL of the android.content.DialogInterface class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: q-mail   File: ConfirmationDialogFragment.java   Source Code and License Vote up 6 votes
@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
        case DialogInterface.BUTTON_POSITIVE: {
            getListener().doPositiveClick(getDialogId());
            break;
        }
        case DialogInterface.BUTTON_NEGATIVE: {
            getListener().doNegativeClick(getDialogId());
            break;
        }
        case DialogInterface.BUTTON_NEUTRAL: {
            getListener().doNegativeClick(getDialogId());
            break;
        }
    }
}
 
Example 2
Project: GitHub   File: DefaultPromptClickListener.java   Source Code and License Vote up 6 votes
@Override
public void onClick(DialogInterface dialog, int which) {

    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        mAgent.update();
        break;
    case DialogInterface.BUTTON_NEUTRAL:
        mAgent.ignore();
        break;
    case DialogInterface.BUTTON_NEGATIVE:
        // not now
        break;
    }
    if (mIsAutoDismiss) {
        dialog.dismiss();
    }
}
 
Example 3
Project: update-master   File: DefaultPromptClickListener.java   Source Code and License Vote up 6 votes
@Override
public void onClick(DialogInterface dialog, int which) {

    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        mAgent.update();
        break;
    case DialogInterface.BUTTON_NEUTRAL:
        mAgent.ignore();
        break;
    case DialogInterface.BUTTON_NEGATIVE:
        // not now
        break;
    }
    if (mIsAutoDismiss) {
        dialog.dismiss();
    }
}
 
Example 4
Project: AOSP-Kayboard-7.1.2   File: AccountsSettingsFragment.java   Source Code and License Vote up 6 votes
@Override
public void onClick(final DialogInterface dialog, final int which) {
    final String oldAccount = getSignedInAccountName();
    switch (which) {
        case DialogInterface.BUTTON_POSITIVE: // Signed in
            final ListView lv = ((AlertDialog)dialog).getListView();
            final String newAccount =
                    (String) lv.getItemAtPosition(lv.getCheckedItemPosition());
            getSharedPreferences()
                    .edit()
                    .putString(PREF_ACCOUNT_NAME, newAccount)
                    .apply();
            AccountStateChangedListener.onAccountSignedIn(oldAccount, newAccount);
            if (mDependentPreference != null) {
                mDependentPreference.setChecked(true);
            }
            break;
        case DialogInterface.BUTTON_NEUTRAL: // Signed out
            AccountStateChangedListener.onAccountSignedOut(oldAccount);
            getSharedPreferences()
                    .edit()
                    .remove(PREF_ACCOUNT_NAME)
                    .apply();
            break;
    }
}
 
Example 5
Project: simple-keyboard   File: ColorDialogPreference.java   Source Code and License Vote up 6 votes
@Override
public void onClick(final DialogInterface dialog, final int which) {
    super.onClick(dialog, which);
    final String key = getKey();
    if (which == DialogInterface.BUTTON_POSITIVE) {
        super.onClick(dialog, which);
        final int value = Color.rgb(
                mSeekBarRed.getProgress(),
                mSeekBarGreen.getProgress(),
                mSeekBarBlue.getProgress());
        mValueProxy.writeValue(value, key);
        return;
    }
    if (which == DialogInterface.BUTTON_NEUTRAL) {
        super.onClick(dialog, which);
        mValueProxy.writeDefaultValue(key);
        return;
    }
}
 
Example 6
Project: MakiLite   File: FiveStarsDialog.java   Source Code and License Vote up 5 votes
@Override
public void onClick(DialogInterface dialogInterface, int i) {
    if(i == DialogInterface.BUTTON_POSITIVE){
        if(ratingBar.getRating() < upperBound){
            if(negativeReviewListener == null){
                sendEmail();
            }else{
                negativeReviewListener.onNegativeReview((int)ratingBar.getRating());
            }

        }else if(!isForceMode){
            openMarket();
        }
        disable();
        if(reviewListener != null)
            reviewListener.onReview((int)ratingBar.getRating());
    }
    if(i == DialogInterface.BUTTON_NEUTRAL){
        disable();
    }
    if(i == DialogInterface.BUTTON_NEGATIVE){
        SharedPreferences.Editor editor = sharedPrefs.edit();
        editor.putInt(SP_NUM_OF_ACCESS, 0);
        editor.apply();
    }
    alertDialog.hide();
}
 
Example 7
Project: youkes_browser   File: BrowserActivity.java   Source Code and License Vote up 5 votes
private void onLinkLongClick2(final String url) {
	DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog, int which) {
               switch (which) {
                   case DialogInterface.BUTTON_POSITIVE:
                       newTab(url, false);
                       break;

                   case DialogInterface.BUTTON_NEGATIVE:
                       getCurrentWebView().loadUrl(url);
                       break;

                   case DialogInterface.BUTTON_NEUTRAL:
                       ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                       ClipData clip = ClipData.newPlainText("label", url);
                       clipboard.setPrimaryClip(clip);
                       break;
               }
           }
       };

	AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
	builder.setTitle(url)
               .setMessage(getResources().getString(R.string.dialog_link))
               .setPositiveButton(getResources().getString(R.string.action_new_tab),
					dialogClickListener)
               .setNegativeButton(getResources().getString(R.string.action_open),
					dialogClickListener)
               .setNeutralButton(getResources().getString(R.string.action_copy),
					dialogClickListener).show();
}
 
Example 8
Project: ADBToolKitsInstaller   File: DonateToMe.java   Source Code and License Vote up 5 votes
public static void show(final Context context) {
    if (context == null) return;
    DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            switch (i) {
                case DialogInterface.BUTTON_NEGATIVE:
                    // wechat
                    showSaveQRCodeDialog(context, R.drawable.wechat_money_revised);
                    break;
                case DialogInterface.BUTTON_POSITIVE:
                    // alipay
                    if (haveInstalledAlipay(context)) {
                        jumpToAlipyScreen(context);
                    } else {
                        showSaveQRCodeDialog(context, R.drawable.alipay_money_revised);
                    }
                    break;
                case DialogInterface.BUTTON_NEUTRAL:
                    break;
            }
        }
    };
    new AlertDialog.Builder(context).setView(R.layout.layout_donate_dialog)
            .setTitle(R.string.title_donate_dialog_donate_methods)
            .setNeutralButton(android.R.string.no, onClickListener)
            .setPositiveButton(R.string.title_donate_dialog_alipay, onClickListener)
            .setNegativeButton(R.string.title_donate_dialog_wechat, onClickListener)
            .show();

}
 
Example 9
Project: mongol-library   File: MongolAlertDialog.java   Source Code and License Vote up 5 votes
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {

        case DialogInterface.BUTTON_POSITIVE:
        case DialogInterface.BUTTON_NEGATIVE:
        case DialogInterface.BUTTON_NEUTRAL:
            ((DialogInterface.OnClickListener) msg.obj).onClick(mDialog.get(), msg.what);
            break;

        case MSG_DISMISS_DIALOG:
            ((DialogInterface) msg.obj).dismiss();
    }
}
 
Example 10
Project: youkes_browser   File: BrowserActivity.java   Source Code and License Vote up 5 votes
/***
 * 功能:用线程保存图片
 *
 *
 */


private void onImageLongClick1(final String url) {
	DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int which) {
			switch (which) {
				case DialogInterface.BUTTON_POSITIVE:
					newTab(url, false);
					break;

				case DialogInterface.BUTTON_NEGATIVE:
					getCurrentWebView().loadUrl(url);
					break;

				case DialogInterface.BUTTON_NEUTRAL:
					if (API > 8) {
						Utils.downloadFile(mActivity, url,
								getCurrentWebView().getUserAgent(), "attachment", false);
					}
					break;
			}
		}
	};

	AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
	builder.setTitle(url.replace(Constants.HTTP, ""))
			.setMessage(getResources().getString(R.string.dialog_image))
			.setPositiveButton(getResources().getString(R.string.action_new_tab),
					dialogClickListener)
			.setNegativeButton(getResources().getString(R.string.action_open),
					dialogClickListener)
			.setNeutralButton(getResources().getString(R.string.action_download),
					dialogClickListener).show();
}
 
Example 11
Project: browser   File: BrowserActivity.java   Source Code and License Vote up 5 votes
private void onLinkLongClick2(final String url) {
	DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog, int which) {
               switch (which) {
                   case DialogInterface.BUTTON_POSITIVE:
                       newTab(url, false);
                       break;

                   case DialogInterface.BUTTON_NEGATIVE:
                       getCurrentWebView().loadUrl(url);
                       break;

                   case DialogInterface.BUTTON_NEUTRAL:
                       ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                       ClipData clip = ClipData.newPlainText("label", url);
                       clipboard.setPrimaryClip(clip);
                       break;
               }
           }
       };

	AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
	builder.setTitle(url)
               .setMessage(getResources().getString(R.string.dialog_link))
               .setPositiveButton(getResources().getString(R.string.action_new_tab),
					dialogClickListener)
               .setNegativeButton(getResources().getString(R.string.action_open),
					dialogClickListener)
               .setNeutralButton(getResources().getString(R.string.action_copy),
					dialogClickListener).show();
}
 
Example 12
Project: youkes_browser   File: BrowserActivity.java   Source Code and License Vote up 5 votes
private void onImageLongClickExtraUrl(final String newUrl) {
	DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog, int which) {
               switch (which) {
                   case DialogInterface.BUTTON_POSITIVE:
                       newTab(newUrl, true);
                       break;

                   case DialogInterface.BUTTON_NEGATIVE:
                       getCurrentWebView().loadUrl(newUrl);
                       break;

                   case DialogInterface.BUTTON_NEUTRAL:
                       if (API > 8) {
                           Utils.downloadFile(mActivity, newUrl,
								getCurrentWebView().getUserAgent(), "attachment", false);
                       }
                       break;
               }
           }
       };

	AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
	builder.setTitle(newUrl.replace(Constants.HTTP, ""))
               .setMessage(getResources().getString(R.string.dialog_image))
               .setPositiveButton(getResources().getString(R.string.action_new_tab),
					dialogClickListener)
               .setNegativeButton(getResources().getString(R.string.action_open),
					dialogClickListener)
               .setNeutralButton(getResources().getString(R.string.action_download),
					dialogClickListener).show();
}
 
Example 13
Project: simple-keyboard   File: CustomInputStylePreference.java   Source Code and License Vote up 5 votes
@Override
public void onClick(final DialogInterface dialog, final int which) {
    super.onClick(dialog, which);
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final boolean isEditing = !isIncomplete();
        final SubtypeLocaleItem locale =
                (SubtypeLocaleItem) mSubtypeLocaleSpinner.getSelectedItem();
        final KeyboardLayoutSetItem layout =
                (KeyboardLayoutSetItem) mKeyboardLayoutSetSpinner.getSelectedItem();
        final InputMethodSubtype subtype =
                AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                        locale.mLocaleString, layout.mLayoutName);
        setSubtype(subtype);
        notifyChanged();
        if (isEditing) {
            mProxy.onSaveCustomInputStyle(this);
        } else {
            mProxy.onAddCustomInputStyle(this);
        }
        break;
    case DialogInterface.BUTTON_NEUTRAL:
        // Nothing to do
        break;
    case DialogInterface.BUTTON_NEGATIVE:
        mProxy.onRemoveCustomInputStyle(this);
        break;
    }
}
 
Example 14
Project: buildAPKsApps   File: AppRater.java   Source Code and License Vote up 5 votes
@Override
public void onClick(DialogInterface di, int id) {
	SharedPreferences.Editor editor = context
			.getSharedPreferences(PREFSFILE, 0).edit();
	switch (id) {
		case DialogInterface.BUTTON_POSITIVE: {
			try {
				context.startActivity(new Intent(Intent.ACTION_VIEW, Uri
						.parse("market://details?id=" + context.getPackageName())));
			}
			catch (ActivityNotFoundException exp) {

			}
			// Fall through intended!
		}
		case DialogInterface.BUTTON_NEGATIVE: {
			editor.putBoolean("dontshowagain", true);
			break;
		}
		case DialogInterface.BUTTON_NEUTRAL:
		default: {
			// Did the user select "Later" because s/he does not have network access
			// right now or because s/he wants to extend the trial period? Let's
			// assume the later and reset the launch counter, as it is the less
			// pesky option.
			editor.putLong("launch_count", 0);
		}
	}
	editor.commit();
	di.dismiss();
}
 
Example 15
Project: Brevent   File: AppsDisabledFragment.java   Source Code and License Vote up 5 votes
@Override
public void onClick(DialogInterface dialog, int which) {
    BreventActivity activity = (BreventActivity) getActivity();
    if (activity == null) {
        return;
    }
    if (which == DialogInterface.BUTTON_POSITIVE) {
        boolean usbConnected = isUsbConnected(activity);
        if (SimpleSu.hasSu()) {
            activity.runAsRoot();
            dismiss();
        } else if (usbConnected && isAdbRunning()) {
            String commandLine = getBootstrapCommandLine(activity, true);
            activity.copy(commandLine);
            String message = getString(R.string.brevent_service_command_copied, commandLine);
            Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
            activity.showDisabled(getArguments().getInt(TITLE, DEFAULT_TITLE), true);
        } else {
            ((BreventApplication) activity.getApplication()).launchDevelopmentSettings();
            activity.showDisabled(getArguments().getInt(TITLE, DEFAULT_TITLE), true);
        }
    } else if (which == DialogInterface.BUTTON_NEUTRAL) {
        activity.openGuide("disabled");
        dismiss();
    } else if (which == DialogInterface.BUTTON_NEGATIVE) {
        if (activity.canFetchLogs()) {
            activity.fetchLogs();
            dismiss();
        } else {
            activity.showDisabled(getArguments().getInt(TITLE, DEFAULT_TITLE), true);
        }
    }
}
 
Example 16
Project: AOSP-Kayboard-7.1.2   File: CustomInputStylePreference.java   Source Code and License Vote up 5 votes
@Override
public void onClick(final DialogInterface dialog, final int which) {
    super.onClick(dialog, which);
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final boolean isEditing = !isIncomplete();
        final SubtypeLocaleItem locale =
                (SubtypeLocaleItem) mSubtypeLocaleSpinner.getSelectedItem();
        final KeyboardLayoutSetItem layout =
                (KeyboardLayoutSetItem) mKeyboardLayoutSetSpinner.getSelectedItem();
        final InputMethodSubtype subtype =
                AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                        locale.mLocaleString, layout.mLayoutName);
        setSubtype(subtype);
        notifyChanged();
        if (isEditing) {
            mProxy.onSaveCustomInputStyle(this);
        } else {
            mProxy.onAddCustomInputStyle(this);
        }
        break;
    case DialogInterface.BUTTON_NEUTRAL:
        // Nothing to do
        break;
    case DialogInterface.BUTTON_NEGATIVE:
        mProxy.onRemoveCustomInputStyle(this);
        break;
    }
}
 
Example 17
Project: dynamic-dialogs   File: DynamicAlertController.java   Source Code and License Vote up 5 votes
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {

        case DialogInterface.BUTTON_POSITIVE:
        case DialogInterface.BUTTON_NEGATIVE:
        case DialogInterface.BUTTON_NEUTRAL:
            ((DialogInterface.OnClickListener) msg.obj).onClick(mDialog.get(), msg.what);
            break;

        case MSG_DISMISS_DIALOG:
            ((DialogInterface) msg.obj).dismiss();
    }
}
 
Example 18
Project: custode   File: SummaryActivity.java   Source Code and License Vote up 5 votes
@Override
public void onClick(DialogInterface dialogInterface, int i) {
    switch (i) {
        case DialogInterface.BUTTON_POSITIVE:
            finish();
            Intent intent = new Intent(SummaryActivity.this, MainActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            break;

        case DialogInterface.BUTTON_NEUTRAL:
            alertAllContacts();
            break;
    }
}
 
Example 19
Project: dynamic-dialogs   File: DynamicAlertController.java   Source Code and License Vote up 5 votes
public Button getButton(int whichButton) {
    switch (whichButton) {
        case DialogInterface.BUTTON_POSITIVE:
            return mButtonPositive;
        case DialogInterface.BUTTON_NEGATIVE:
            return mButtonNegative;
        case DialogInterface.BUTTON_NEUTRAL:
            return mButtonNeutral;
        default:
            return null;
    }
}
 
Example 20
Project: OSchina_resources_android   File: TeamNewIssueActivity.java   Source Code and License Vote up 4 votes
private void showIssueDeadlineTime() {

        final DatePickerDialog dateDialog = new DatePickerDialog(this,
                new DatePickerDialog.OnDateSetListener() {

                    @Override
                    public void onDateSet(DatePicker view, int year,
                                          int monthOfYear, int dayOfMonth) {
                    }

                }, mYear, mMonth, mDay);
        DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                switch (which) {
                    case DialogInterface.BUTTON_NEGATIVE:
                        break;
                    case DialogInterface.BUTTON_NEUTRAL:
                        issueTime = "";
                        mTvTime.setText(issueTime);
                        break;
                    case DialogInterface.BUTTON_POSITIVE:
                        mYear = dateDialog.getDatePicker().getYear();
                        mMonth = dateDialog.getDatePicker().getMonth();
                        mDay = dateDialog.getDatePicker().getDayOfMonth();
                        issueTime = mYear + "-" + (mMonth + 1) + "-" + mDay;
                        mTvTime.setText(issueTime);
                        break;

                    default:
                        break;
                }
            }
        };
        dateDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",
                clickListener);
        dateDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "清除",
                clickListener);
        dateDialog.setButton(DialogInterface.BUTTON_POSITIVE, "确认",
                clickListener);
        dateDialog.show();
    }