當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。