本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}