本文整理汇总了Java中android.content.DialogInterface.BUTTON_NEUTRAL属性的典型用法代码示例。如果您正苦于以下问题:Java DialogInterface.BUTTON_NEUTRAL属性的具体用法?Java DialogInterface.BUTTON_NEUTRAL怎么用?Java DialogInterface.BUTTON_NEUTRAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.DialogInterface
的用法示例。
在下文中一共展示了DialogInterface.BUTTON_NEUTRAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
@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;
}
}
}
示例2: onClick
@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();
}
}
示例3: onClick
@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;
}
}
示例4: onClick
@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;
}
}
示例5: onClick
@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();
}
示例6: onLinkLongClick2
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();
}
示例7: show
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();
}
示例8: handleMessage
@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();
}
}
示例9: onImageLongClick1
/***
* 功能:用线程保存图片
*
*
*/
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();
}
示例10: onImageLongClickExtraUrl
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();
}
示例11: onClick
@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;
}
}
示例12: onClick
@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();
}
示例13: onClick
@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);
}
}
}
示例14: onClick
@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;
}
}
示例15: getButton
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;
}
}