本文整理匯總了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);
}