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