Java 类com.afollestad.materialdialogs.DialogAction 实例源码

项目:https-github.com-hyb1996-NoRootScriptDroid    文件:MyScriptListFragment.java   
@Optional
@OnClick(R.id.delete)
void deleteScriptFile() {
    dismissDialogs();
    new MaterialDialog.Builder(getActivity())
            .title(R.string.delete_confirm)
            .positiveText(R.string.cancel)
            .negativeText(R.string.ok)
            .onNegative(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    doDeletingScriptFile();
                }
            })
            .show();
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:MyScriptListFragment.java   
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
    if (mIsFirstTextChanged) {
        mIsFirstTextChanged = false;
        return;
    }
    EditText editText = dialog.getInputEditText();
    if (editText == null)
        return;
    int errorResId = 0;
    if (input == null || input.length() == 0) {
        errorResId = R.string.text_name_should_not_be_empty;
    } else if (!input.equals(mExcluded)) {
        if (new File(getCurrentDirectory(), mIsDirectory ? input.toString() : input.toString() + ".js").exists()) {
            errorResId = R.string.text_file_exists;
        }
    }
    if (errorResId == 0) {
        editText.setError(null);
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
    } else {
        editText.setError(getString(errorResId));
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
    }

}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:ScriptLoopDialog.java   
public ScriptLoopDialog(Context context, ScriptFile file) {
    mScriptFile = file;
    View view = View.inflate(context, R.layout.dialog_script_loop, null);
    mDialog = new MaterialDialog.Builder(context)
            .title(R.string.text_run_repeatedly)
            .customView(view, true)
            .positiveText(R.string.ok)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    startScriptRunningLoop();
                }
            })
            .build();
    ButterKnife.bind(this, view);
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:ScriptOperations.java   
private Observable<String> showNameInputDialog(String prefix, MaterialDialog.InputCallback textWatcher) {
    final PublishSubject<String> input = PublishSubject.create();
    DialogUtils.showDialog(new ThemeColorMaterialDialogBuilder(mContext).title(R.string.text_name)
            .inputType(InputType.TYPE_CLASS_TEXT)
            .alwaysCallInputCallback()
            .input(getString(R.string.text_please_input_name), prefix, false, textWatcher)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    input.onNext(dialog.getInputEditText().getText().toString());
                    input.onComplete();
                }
            })
            .build());
    return input;
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:ScriptOperations.java   
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
    if (mIsFirstTextChanged) {
        mIsFirstTextChanged = false;
        return;
    }
    EditText editText = dialog.getInputEditText();
    if (editText == null)
        return;
    int errorResId = 0;
    if (input == null || input.length() == 0) {
        errorResId = R.string.text_name_should_not_be_empty;
    } else if (!input.equals(mExcluded)) {
        if (new File(getCurrentDirectory(), mExtension == null ? input.toString() : input.toString() + mExtension).exists()) {
            errorResId = R.string.text_file_exists;
        }
    }
    if (errorResId == 0) {
        editText.setError(null);
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
    } else {
        editText.setError(getString(errorResId));
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
    }

}
项目:GitHub    文件:ColorChooserDialog.java   
@Override
public void onClick(View v) {
    if (v.getTag() != null) {
        final String[] tag = ((String) v.getTag()).split(":");
        final int index = Integer.parseInt(tag[0]);
        final MaterialDialog dialog = (MaterialDialog) getDialog();
        final Builder builder = getBuilder();

        if (isInSub()) {
            subIndex(index);
        } else {
            topIndex(index);
            if (mColorsSub != null && index < mColorsSub.length) {
                dialog.setActionButton(DialogAction.NEGATIVE, builder.mBackBtn);
                isInSub(true);
            }
        }

        if (builder.mAllowUserCustom)
            selectedCustomColor = getSelectedColor();
        invalidateDynamicButtonColors();
        invalidate();
    }
}
项目:GitHub    文件:MainActivity.java   
@OnClick(R.id.input_custominvalidation) public void showInputDialogCustomInvalidation() {
    new MaterialDialog.Builder(this)
            .title(R.string.input)
            .content(R.string.input_content_custominvalidation)
            .inputType(InputType.TYPE_CLASS_TEXT |
                    InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
                    InputType.TYPE_TEXT_FLAG_CAP_WORDS)
            .positiveText(R.string.submit)
            .alwaysCallInputCallback() // this forces the callback to be invoked with every input change
            .input(R.string.input_hint, 0, false, (dialog, input) -> {
                if (input.toString().equalsIgnoreCase("hello")) {
                    dialog.setContent("I told you not to type that!");
                    dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
                } else {
                    dialog.setContent(R.string.input_content_custominvalidation);
                    dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
                }
            }).show();
}
项目:FriendBook    文件:MainPresenter.java   
private void showAppUpdateDialog(final Activity activity, final AppRelease release) {
    new MaterialDialog
            .Builder(activity)
            .title("新版本:"+release.getVersionName())
            .content(release.getReleaseNotes())
            .positiveText("立即下载")
            .negativeText("以后再说")
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    UpdateService.Builder.create(release.getSourceFileUrl()).build(activity);
                }
            })
            .show();

}
项目:FriendBook    文件:BookcaseFragment.java   
private void showDeleteConfirmDialog() {
    new MaterialDialog
            .Builder(getActivity())
            .title("确认删除")
            .content("真的要将这" + bookcaseAdapter.getSelectedBookTbs().size() + "本书从书架中删除吗?")
            .positiveText("删除")
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    getPresenter().deleteItems(bookcaseAdapter.getSelectedBookTbs());
                    toggleEditMenu();
                    bookcaseAdapter.cancelEdit();
                }
            })
            .negativeText("取消")
            .show();
}
项目:Clipcon-AndroidClient    文件:GroupActivity.java   
@Override
public void onBackPressed() {

    new MaterialDialog.Builder(this)
            .content(R.string.exitAlert)
            .negativeText(R.string.no)
            .positiveText(R.string.yes)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    new EndpointInBackGround().execute(Message.REQUEST_EXIT_GROUP);
                    Intent intent = new Intent(getApplicationContext(), ClipboardService.class);
                    stopService(intent);
                    GroupActivity.super.onBackPressed();
                }
            })
            .show();
}
项目:ScanLinks    文件:MainActivity.java   
public void showFirstRunDialog() {
    MaterialDialog frDialog = new MaterialDialog.Builder(this)
            .title(getString(R.string.welcome_app_dialog_title))
            .content(getString(R.string.welcome_app_text))
            .positiveText(getString(R.string.welcome_app_dialog_positive_text))
            .cancelable(false)
            .autoDismiss(false)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                    Prefs.putBoolean("firstRun", false);
                }
            })
            .build();
    frDialog.show();
}
项目:Orin    文件:ClearSmartPlaylistDialog.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    //noinspection unchecked
    final AbsSmartPlaylist playlist = getArguments().getParcelable("playlist");
    int title = R.string.clear_playlist_title;
    //noinspection ConstantConditions
    CharSequence content = Html.fromHtml(getString(R.string.clear_playlist_x, playlist.name));

    return new MaterialDialog.Builder(getActivity())
            .title(title)
            .content(content)
            .positiveText(R.string.clear_action)
            .negativeText(android.R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    if (getActivity() == null) {
                        return;
                    }
                    playlist.clear(getActivity());
                }
            })
            .build();
}
项目:Auto.js    文件:ScriptLoopDialog.java   
public ScriptLoopDialog(Context context, ScriptFile file) {
    mScriptFile = file;
    View view = View.inflate(context, R.layout.dialog_script_loop, null);
    mDialog = new MaterialDialog.Builder(context)
            .title(R.string.text_run_repeatedly)
            .customView(view, true)
            .positiveText(R.string.ok)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    startScriptRunningLoop();
                }
            })
            .build();
    ButterKnife.bind(this, view);
}
项目:Auto.js    文件:ScriptOperations.java   
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
    if (mIsFirstTextChanged) {
        mIsFirstTextChanged = false;
        return;
    }
    EditText editText = dialog.getInputEditText();
    if (editText == null)
        return;
    int errorResId = 0;
    if (input == null || input.length() == 0) {
        errorResId = R.string.text_name_should_not_be_empty;
    } else if (!input.equals(mExcluded)) {
        if (new File(getCurrentDirectory(), mExtension == null ? input.toString() : input.toString() + mExtension).exists()) {
            errorResId = R.string.text_file_exists;
        }
    }
    if (errorResId == 0) {
        editText.setError(null);
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
    } else {
        editText.setError(getString(errorResId));
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
    }

}
项目:quire    文件:WelcomeActivity.java   
@Override
public void show500ServerError() {

    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_server_error)
            .content(R.string.all_dialog_try_again)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:WelcomeActivity.java   
@Override
public void showNoInternetConnectionError() {

    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_connection_error_title)
            .content(R.string.all_dialog_connection_error_content)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:ViewSingleUserListingActivity.java   
@Override
public void showSuccessDialog() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.view_single_dialog_title_success)
            .content(R.string.view_single_dialog_content_success)
            .positiveText(R.string.view_single_dialog_positive_continue).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();
                    startActivity(new Intent(mContext, NearbyProductsActivity.class));
                    overridePendingTransition(R.anim.left_out, R.anim.right_in);

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:UpdateUserListingActivity.java   
@Override
public void showSuccessDialog() {
    builder = new MaterialDialog.Builder(mContext)
            .title("Success")
            .content("Your listing has been updated!")
            .positiveText("Continue").onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();
                    startActivity(new Intent(mContext, NearbyProductsActivity.class));
                    overridePendingTransition(R.anim.left_out, R.anim.right_in);

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:UpdateUserListingActivity.java   
@Override
public void showTimeOutError() {
    builder = new MaterialDialog.Builder(mContext)
            .title("Timeout Error")
            .content("Please check your internet connection and try again.")
            .positiveText("Aceptar").onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:UpdateUserListingActivity.java   
@Override
public void show500ServerError() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_server_error)
            .content(R.string.all_dialog_try_again)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:UpdateUserListingActivity.java   
@Override
public void showNetworkError() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_network_error_title)
            .content(R.string.all_dialog_try_again)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:ListNewItemActivity.java   
@Override
public void showSuccessDialog() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.view_single_dialog_title_success)
            .content(R.string.nearby_dialog_listing_created)
            .positiveText(R.string.view_single_dialog_positive_continue).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();
                    startActivity(new Intent(mContext, NearbyProductsActivity.class));
                    overridePendingTransition(R.anim.left_out, R.anim.right_in);

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:ListNewItemActivity.java   
@Override
public void showRequiredImagesDialog() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.new_item_dialog_title_missing_image)
            .content(R.string.new_item_dialog_content_missing_image)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

                    dialog.dismiss();

                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:ListNewItemActivity.java   
@Override
public void showTimeOutError() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_timeout_error_title)
            .content(R.string.all_dialog_timeout_error_content)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:quire    文件:ListNewItemActivity.java   
@Override
public void show500ServerError() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_server_error)
            .content(R.string.all_dialog_try_again)
            .positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            });

    dialog = builder.build();
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
}
项目:Nearby    文件:AdminMainActivity.java   
@Override
public void onBackPressed() {
    new MaterialDialog.Builder(this)
            .title(R.string.ok)
            .content(R.string.are_you_finish_app)
            .positiveText(R.string.finish)
            .negativeText(R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.putExtra("EXIT", true);
                    startActivity(intent);
                    finish();
                }
            })
            .show();
}
项目:Nearby    文件:NurseRecordActivity.java   
private void showNeedPermissionDialog(){

        new MaterialDialog.Builder(this)
                .title(R.string.check_srt)
                .content(R.string.required_permission)
                .positiveText(R.string.ok)
                .negativeText(R.string.cancel)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                                Uri.parse("package:" + getPackageName()));
                        myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);
                        myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity(myAppSettings);

                    }
                })
                .show();


    }
项目:Nearby    文件:NurseMainActivity.java   
@Override
public void onBackPressed() {
    new MaterialDialog.Builder(this)
            .title(R.string.ok)
            .content(R.string.are_you_finish_app)
            .positiveText(R.string.finish)
            .negativeText(R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.putExtra("EXIT", true);
                    startActivity(intent);
                    finish();
                }
            })
            .show();
}
项目:Nearby    文件:BaseActivity.java   
public void logout(Activity activity){

        new MaterialDialog.Builder(activity)
                .title(R.string.ok)
                .content(R.string.are_you_sure_logout)
                .positiveText(R.string.logout)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        SharedPreferences.Editor editor = getSharedPreferences("setting", 0).edit();
                        editor.putString("login_id", null);
                        editor.putString("login_pw", null);
                        editor.putBoolean("isEmployee", false);
                        editor.commit();

                        StartActivity.initLoginData();
                        Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);
                        finish();
                    }
                })
                .negativeText(R.string.cancel)
                .show();

    }
项目:Nearby    文件:RecordVitalSignActivity.java   
private void showNeedPermissionDialog(){

        new MaterialDialog.Builder(this)
                .title(R.string.check_srt)
                .content(R.string.required_permission)
                .positiveText(R.string.ok)
                .negativeText(R.string.cancel)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                                Uri.parse("package:" + getPackageName()));
                        myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);
                        myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity(myAppSettings);

                    }
                })
                .show();

    }
项目:Nearby    文件:SearchMedicineActivity.java   
public void selectMedicine(final Medicine medicine){

        String content = "";
        content = "이 약을 새롭게 추가하겠습니까?\n\n" +
                "약명 : " + medicine.getName() + "\n" +
                "보험코드 : " + medicine.getCode() + "\n" +
                "제조회사 : " + medicine.getCompany() + "\n" +
                "용량 : " + medicine.getStandard() + medicine.getUnit();

        new MaterialDialog.Builder(this)
                .title(R.string.ok)
                .content(content)
                .positiveText(R.string.ok)
                .negativeText(R.string.cancel)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        Intent intent = new Intent();
                        intent.putExtra("medicine", medicine);
                        setResult(SELECTED_MEDICINE, intent);
                        finish();
                    }
                })
                .show();

    }
项目:anitrend-app    文件:MainActivity.java   
/**
 * When Material Dialog on click occurs
 */
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

    if(mNavigationIndex == R.id.nav_anime || mNavigationIndex == R.id.nav_manga || mNavigationIndex == R.id.nav_myanime || mNavigationIndex == R.id.nav_mymanga || mNavigationIndex == R.id.nav_hub) {
        mPresenter.createSuperToast(MainActivity.this,
                getString(R.string.text_filter_applying),
                R.drawable.ic_reset,
                Style.TYPE_PROGRESS_BAR, Style.DURATION_VERY_SHORT,
                PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN));
    } else {
        mPresenter.createSuperToast(MainActivity.this,
                getString(R.string.text_filter_restriction),
                R.drawable.ic_info_outline_white_18dp,
                Style.TYPE_STANDARD, Style.DURATION_VERY_SHORT,
                PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_ORANGE));
    }
}
项目:anitrend-app    文件:SplashPresenter.java   
public void requestAppReset() {
    new DialogManager(mContext).createDialogMessage("Authentication Error", Html.fromHtml(mContext.getString(R.string.app_splash_authenticating_message)),
            mContext.getString(R.string.Yes), mContext.getString(R.string.No), new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            switch (which) {
                case POSITIVE:
                    makeAlerterInfo("Application has been reset!");
                    ServiceGenerator.authStateChange(mContext);
                    new ApplicationPrefs(mContext).setUserDeactivated();
                    mContext.onRefresh();
                    break;
                case NEGATIVE:
                    dialog.dismiss();
                    break;
            }
        }
    });
}
项目:anitrend-app    文件:DialogManager.java   
public void createDialogSelection(String title , int selection, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice, MaterialDialog.SingleButtonCallback positive, int index){
    new MaterialDialog.Builder(mContext)
            .title(title)
            .items(selection)
            .typeface(Typeface.SANS_SERIF,Typeface.SANS_SERIF)
            .iconRes(app_prefs.isLightTheme()?R.drawable.ic_view_list_black_24dp:R.drawable.ic_view_list_white_24dp)
            .buttonRippleColorRes(R.color.colorAccent)
            .positiveColorRes(R.color.colorStateBlue)
            .negativeColorRes(R.color.colorStateOrange)
            .theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
            .itemsCallbackSingleChoice(index, callbackSingleChoice)
            .positiveText(R.string.Apply)
            .neutralText(R.string.Cancel)
            .onPositive(positive)
            .onNeutral(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            })
            .show();
}
项目:anitrend-app    文件:DialogManager.java   
public void createDialogSelection(String title, Collection selection, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice, MaterialDialog.SingleButtonCallback positive, int index){
    new MaterialDialog.Builder(mContext)
            .title(title)
            .items(selection)
            .typeface(Typeface.SANS_SERIF,Typeface.SANS_SERIF)
            .iconRes(app_prefs.isLightTheme()?R.drawable.ic_view_list_black_24dp:R.drawable.ic_view_list_white_24dp)
            .buttonRippleColorRes(R.color.colorAccent)
            .positiveColorRes(R.color.colorStateBlue)
            .negativeColorRes(R.color.colorStateOrange)
            .theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
            .itemsCallbackSingleChoice(index, callbackSingleChoice)
            .positiveText(R.string.Apply)
            .neutralText(R.string.Cancel)
            .onPositive(positive)
            .onNeutral(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            })
            .show();
}
项目:ModPE-IDE-Source    文件:LModActivity.java   
public void checkErrors() {
    new MaterialDialog.Builder(LModActivity.this)
            .title(R.string.dialog_premium_version)
            .content(R.string.dialog_only_in_premium)
            .positiveText(R.string.buy_premium)
            .negativeText(R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog,
                                    @NonNull DialogAction which) {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse(getResources().getString(R.string.premium_url))));
                }
            })
            .show();
}
项目:QiangHongBao    文件:MainActivity.java   
/** 打开辅助服务的设置 */
private void openAccessibilityServiceSettings() {
    new MaterialDialog.Builder(this)
            .title(R.string.open_service_title)
            .customView(R.layout.view_open_service_hint, false)
            .positiveText(R.string.open_service_button)
            .onAny(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    switch (which) {
                        case POSITIVE:
                            try {
                                Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                                startActivity(intent);
                                ToastUtils.show("找到[快手抢红包],然后开启服务即可");
                            } catch (Exception e) {
                                LogUtils.e(e);
                            }
                            break;
                    }

                }
            })
            .show();
}
项目:RetroMusicPlayer    文件:ClearSmartPlaylistDialog.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    //noinspection unchecked
    final AbsSmartPlaylist playlist = getArguments().getParcelable("playlist");
    int title = R.string.clear_playlist_title;
    //noinspection ConstantConditions
    CharSequence content = Html.fromHtml(getString(R.string.clear_playlist_x, playlist.name));

    return new MaterialDialog.Builder(getActivity())
            .title(title)
            .content(content)
            .positiveText(R.string.clear_action)
            .negativeText(android.R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    if (getActivity() == null) {
                        return;
                    }
                    playlist.clear(getActivity());
                }
            })
            .build();
}
项目:QiangHongBao    文件:MainActivity.java   
private void exit() {
    if(!QHBService.isRun()){
        AppManager.getInstance().exitApp(true);
        return;
    }
    new MaterialDialog.Builder(getActivity())
            .title("退出服务")
            .content("找到[快手抢红包],然后关闭服务再退出即可")
            .negativeText("取消")
            .positiveText("确认")
            .onAny(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    switch (which) {
                        case POSITIVE:
                            getActivity().startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
                            break;
                    }

                }
            })
            .show();
}
项目:Pocket-Plays-for-Twitch    文件:SettingsTwitchChatActivity.java   
public void onClickChatLandScapeWidth(View v) {
    final int landscapeWidth = settings.getChatLandscapeWidth();

    DialogService.getSliderDialog(
            this,
            new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    settings.setChatLandscapeWidth(landscapeWidth);
                    updateSummaries();
                }
            },
            new Slider.OnPositionChangeListener() {
                @Override
                public void onPositionChanged(Slider view, boolean fromUser, float oldPos, float newPos, int oldValue, int newValue) {
                    settings.setChatLandscapeWidth(newValue);
                    updateSummaries();
                }
            },
            landscapeWidth,
            25,
            60,
            getString(R.string.chat_landscape_width_dialog)
    ).show();
}