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


Java MaterialDialog.InputCallback方法代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.MaterialDialog.InputCallback方法的典型用法代码示例。如果您正苦于以下问题:Java MaterialDialog.InputCallback方法的具体用法?Java MaterialDialog.InputCallback怎么用?Java MaterialDialog.InputCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.afollestad.materialdialogs.MaterialDialog的用法示例。


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

示例1: showNameInputDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的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

示例2: createDialogInput

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
/**
 * Creates a dialog to type in text
 */
public void createDialogInput(String header, String content, MaterialDialog.InputCallback callback, MaterialDialog.SingleButtonCallback buttonCallback) {
    new MaterialDialog.Builder(mContext)
            .positiveText(R.string.Ok)
            .negativeText(R.string.Cancel)
            //.neutralText(R.string.attach_media)
            .autoDismiss(false)
            .onAny(buttonCallback)
            .buttonRippleColorRes(R.color.colorAccent)
            .positiveColorRes(R.color.colorStateBlue)
            .negativeColorRes(R.color.colorStateOrange)
            .theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
            .title(header)
            .content(content)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE | InputType.TYPE_TEXT_FLAG_MULTI_LINE)
            .input(mContext.getString(R.string.text_enter_text), null, callback)
            .show();
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:21,代码来源:DialogManager.java

示例3: showFilenameSuggestingDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public static void showFilenameSuggestingDialog(final Context context,
                                                final MaterialDialog.SingleButtonCallback callback,
                                                final MaterialDialog.InputCallback inputCallback, int titleResId) {


    MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
    builder.title(titleResId)
            .negativeText(android.R.string.cancel)
            .positiveText(android.R.string.ok)
            .content(R.string.enter_filename)
            .input("", "", inputCallback)
            .onAny(callback);

    MaterialDialog show = builder.show();
    initFilenameInputDialog(show);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:DialogHelper.java

示例4: showNameInputDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的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((dialog, which) -> {
                input.onNext(dialog.getInputEditText().getText().toString());
                input.onComplete();
            })
            .build());
    return input;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:14,代码来源:ScriptOperations.java

示例5: showSaveLogDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
private void showSaveLogDialog() {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
            != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                SAVE_LOG_REQUEST);
        return;
    }

    if (!SaveLogHelper.checkSdCard(this)) {
        return;
    }

    MaterialDialog.InputCallback onClickListener = new MaterialDialog.InputCallback() {
        @Override
        public void onInput(@NonNull MaterialDialog materialDialog, CharSequence charSequence) {
            if (DialogHelper.isInvalidFilename(charSequence)) {
                Toast.makeText(LogcatActivity.this, R.string.enter_good_filename, Toast.LENGTH_SHORT).show();
            } else {
                String filename = charSequence.toString();
                saveLog(filename);
            }
        }
    };

    DialogHelper.showFilenameSuggestingDialog(this, null, onClickListener, R.string.save_log);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:28,代码来源:LogcatActivity.java

示例6: completePartialSelect

import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
private void completePartialSelect() {

        if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                    COMPLETE_PARTIAL_SELECT_REQUEST);
            return;
        }
        if (!SaveLogHelper.checkSdCard(this)) {
            cancelPartialSelect();
            return;
        }

        MaterialDialog.InputCallback onClickListener = new MaterialDialog.InputCallback() {

            @Override
            public void onInput(@NonNull MaterialDialog materialDialog, CharSequence charSequence) {
                if (DialogHelper.isInvalidFilename(charSequence)) {
                    cancelPartialSelect();
                    Toast.makeText(LogcatActivity.this, R.string.enter_good_filename, Toast.LENGTH_SHORT).show();
                } else {
                    String filename = charSequence.toString();
                    savePartialLog(filename, partiallySelectedLogLines.get(0), partiallySelectedLogLines.get(1));
                }
            }
        };


        MaterialDialog.SingleButtonCallback onCancelListener = new MaterialDialog.SingleButtonCallback() {
            @Override
            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                if (which == DialogAction.NEGATIVE) {
                    cancelPartialSelect();
                }
            }
        };

        DialogHelper.showFilenameSuggestingDialog(this, onCancelListener, onClickListener, R.string.save_log);

    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:42,代码来源:LogcatActivity.java


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