当前位置: 首页>>代码示例>>Java>>正文


Java DialogAction类代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.DialogAction的典型用法代码示例。如果您正苦于以下问题:Java DialogAction类的具体用法?Java DialogAction怎么用?Java DialogAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DialogAction类属于com.afollestad.materialdialogs包,在下文中一共展示了DialogAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteScriptFile

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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();
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:17,代码来源:MyScriptListFragment.java

示例2: onInput

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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);
    }

}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:27,代码来源:MyScriptListFragment.java

示例3: ScriptLoopDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
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);
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:17,代码来源:ScriptLoopDialog.java

示例4: showNameInputDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
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;
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:17,代码来源:ScriptOperations.java

示例5: onInput

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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);
    }

}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:27,代码来源:ScriptOperations.java

示例6: onClick

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:ColorChooserDialog.java

示例7: showInputDialogCustomInvalidation

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MainActivity.java

示例8: showAppUpdateDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
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();

}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:17,代码来源:MainPresenter.java

示例9: showDeleteConfirmDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
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();
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:18,代码来源:BookcaseFragment.java

示例10: onBackPressed

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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();
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-AndroidClient,代码行数:19,代码来源:GroupActivity.java

示例11: showFirstRunDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
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();
}
 
开发者ID:theblixguy,项目名称:ScanLinks,代码行数:18,代码来源:MainActivity.java

示例12: onCreateDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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();
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:26,代码来源:ClearSmartPlaylistDialog.java

示例13: show500ServerError

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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);
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:20,代码来源:WelcomeActivity.java

示例14: showNoInternetConnectionError

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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);
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:18,代码来源:WelcomeActivity.java

示例15: showSuccessDialog

import com.afollestad.materialdialogs.DialogAction; //导入依赖的package包/类
@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);
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:21,代码来源:ViewSingleUserListingActivity.java


注:本文中的com.afollestad.materialdialogs.DialogAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。