本文整理汇总了Java中android.content.DialogInterface.BUTTON_POSITIVE属性的典型用法代码示例。如果您正苦于以下问题:Java DialogInterface.BUTTON_POSITIVE属性的具体用法?Java DialogInterface.BUTTON_POSITIVE怎么用?Java DialogInterface.BUTTON_POSITIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.DialogInterface
的用法示例。
在下文中一共展示了DialogInterface.BUTTON_POSITIVE属性的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) {
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;
}
}
示例4: onGroupDelete
@Override
public void onGroupDelete(int groupPosition, final String groupId) {
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
FirebaseHelper.deleteUserFromGroup(groupId); // Delete user from Firebase
case DialogInterface.BUTTON_NEGATIVE:
break;
}
}
};
// Show alert with 'yes' and 'no' answer options
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getContext());
alertBuilder.setMessage("Weet je zeker dat je deze groep wilt verlaten?")
.setPositiveButton("Ja", dialogClickListener).setNegativeButton("Nee",
dialogClickListener).show();
}
示例5: 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;
}
}
示例6: onClick
/**
* Listens for user's actions.
* @param dialog Current instance of dialog.
* @param which Id of pressed button.
*/
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
//If user presses positive button
case DialogInterface.BUTTON_POSITIVE:
//Check if user gave us a listener
if (mOnDateSetListener != null)
//Set picked year and month to the listener
mOnDateSetListener.onYearMonthSet(mYear, mMonth);
break;
//If user presses negative button
case DialogInterface.BUTTON_NEGATIVE:
//Exit the dialog
dialog.cancel();
break;
}
}
示例7: confirmation_dialogbox
public void confirmation_dialogbox(final DatabaseReference databaseReference1, final String new_subject)
{
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which){
case DialogInterface.BUTTON_POSITIVE:
databaseReference1.push().setValue(new_subject);
//Yes button clicked
break;
case DialogInterface.BUTTON_NEGATIVE:
//No button clicked
break;
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("Are you sure want to create new subject with name "+new_subject+" ?").setPositiveButton("Yes", dialogClickListener)
.setNegativeButton("No", dialogClickListener).show();
}
示例8: onCreateDialog
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@SuppressLint("InflateParams")
View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_create_note, null);
final TextInputLayout titleView = (TextInputLayout) view.findViewById(R.id.textInputLayout_title);
titleView.setHint(getString(R.string.query));
view.findViewById(R.id.textInputLayout_content).setVisibility(View.GONE);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
if (getParentFragment() instanceof NoteContainerFragment) {
((NoteContainerFragment) getParentFragment()).search(titleView.getEditText().getText().toString());
} else {
throw new IllegalStateException();
}
break;
}
}
};
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.search)
.setView(view)
.setPositiveButton(android.R.string.ok, onClickListener)
.setNegativeButton(android.R.string.cancel, onClickListener)
.create();
}
示例9: selectOpeningFile
private void selectOpeningFile(File inputFile) {
String bookName = InternalStorageFileHelper.fileNameWithoutExtension(inputFile);
if (InternalStorageFileHelper.isFileWasOpened(this, inputFile)) {
DialogInterface.OnClickListener dialogClickListener = (dialog, which) -> {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
openFileWithUI(inputFile);
break;
case DialogInterface.BUTTON_NEGATIVE:
break;
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.book_rewriting_confirm) + "\"" +
bookName +
"\"")
.setPositiveButton(R.string.yes, dialogClickListener)
.setNegativeButton(R.string.no, dialogClickListener)
.show();
} else {
openFileWithUI(inputFile);
}
}
示例10: onClick
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
ProfileManager.setConntectedVpnProfileDisconnected(this);
if (mService != null && mService.getManagement() != null) {
mService.getManagement().stopVPN(false);
}
}
finish();
}
示例11: onDismiss
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (whichButtonClicked == DialogInterface.BUTTON_POSITIVE
&& preference instanceof ColumnCountPreference) {
ColumnCountPreference columnCountPreference =
((ColumnCountPreference) preference);
columnCountPreference.setColumnCount(columnCount);
Settings.getInstance(getActivity())
.setColumnCount(columnCount);
}
}
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:13,代码来源:ColumnCountPreferenceDialogFragment.java
示例12: onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_settings);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(toolbar);
// adds up navigation to the toolbar on top
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
spinner = findViewById(R.id.progressBar2);
dbHelper = DBHelper.getInstance();
deleteAccountBtn = findViewById(R.id.deleteAccountBtn);
dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(which == DialogInterface.BUTTON_POSITIVE){
deleteAccountBtn.setVisibility(View.GONE);
spinner.setVisibility(View.VISIBLE);
deleteAccount();
}
}
};
deleteAccountBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
builder.setMessage( "Delete your account and all account data?" )
.setNegativeButton("Cancel", null)
.setPositiveButton("Confirm", dialogClickListener)
.show();
}
});
}
示例13: 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;
}
}
示例14: onClick
@Override
public void onClick(DialogInterface dialog, int which) {
Activity activity = getActivity();
if (activity == null) {
return;
}
if (DialogInterface.BUTTON_POSITIVE == which) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.FEEDBACK));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
activity.startActivity(intent);
} else if (DialogInterface.BUTTON_NEGATIVE == which) {
BreventActivity.sendEmail(activity, null, Build.FINGERPRINT);
}
}
示例15: onDismiss
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (whichButtonClicked == DialogInterface.BUTTON_POSITIVE
&& preference instanceof StylePreference) {
StylePreference stylePreference =
((StylePreference) preference);
stylePreference.setStyle(selectedStyle);
Settings.getInstance(getActivity()).setStyle(selectedStyle);
}
}