本文整理汇总了Java中com.afollestad.materialdialogs.MaterialDialog.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java MaterialDialog.Builder方法的具体用法?Java MaterialDialog.Builder怎么用?Java MaterialDialog.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.afollestad.materialdialogs.MaterialDialog
的用法示例。
在下文中一共展示了MaterialDialog.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deletePlaylistDailog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
/**
* Delete playlist Dialog
*
* @param context
* @param Playlistname
*/
public static void deletePlaylistDailog(@NonNull Context context, String Playlistname, RefreshPlaylist refreshPlaylist) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
builder.title(Playlistname);
builder.content(R.string.deleteplaylist);
builder.positiveText(R.string.delete);
builder.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
deletePlaylist(context, Playlistname);
Toast.makeText(context, Playlistname + " Deleted", Toast.LENGTH_SHORT).show();
refreshPlaylist.refresh();
}
});
builder.typeface(Helper.getFont(context), Helper.getFont(context));
builder.negativeText(R.string.cancel);
builder.show();
}
示例2: 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);
}
示例3: onCreateDialog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.playlist_picker, new LinearLayout(getActivity()), false);
rv = (RecyclerView) view.findViewById(R.id.rv);
btn = (Button) view.findViewById(R.id.create_playlist);
btn.setVisibility(View.GONE);
MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
CustomLayoutManager customlayoutmanager = new CustomLayoutManager(getActivity());
customlayoutmanager.setOrientation(LinearLayoutManager.VERTICAL);
customlayoutmanager.setSmoothScrollbarEnabled(true);
rv.setLayoutManager(customlayoutmanager);
tabAdapter = new RemoveTabAdapter(getActivity(), this);
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(tabAdapter);
mItemTouchHelper = new ItemTouchHelper(callback);
mItemTouchHelper.attachToRecyclerView(rv);
List<String> data = new ArrayList<String>();
data.add("1. Recent");
data.add("2. Folder");
data.add("3. Song");
data.add("4. Album");
data.add("5. Artist");
data.add("6.Playlist");
tabAdapter.addDataList(data);
rv.setAdapter(tabAdapter);
builder.title("Tab Remove")
.autoDismiss(true)
.positiveText(R.string.okay)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
})
.customView(view, false);
return builder.show();
}
示例4: itemsCallbackMultiChoice
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public MaterialDialog.Builder itemsCallbackMultiChoice(@Nullable Integer[] selectedIndices, final VolatileBox<Integer[]> result) {
dismissListener(result);
super.itemsCallbackMultiChoice(selectedIndices, new ListCallbackMultiChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
result.setAndNotify(which);
return true;
}
});
return this;
}
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:12,代码来源:BlockedMaterialDialog.java
示例5: newSimpleProgressLoadingBuilder
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
protected static MaterialDialog.Builder newSimpleProgressLoadingBuilder(Context context, CharSequence cs) {
CharSequence message = "加载中...";
if (!TextUtils.isEmpty(cs)) {
message = cs;
}
return newBuilder(context).title(message).progress(true, 0);
}
示例6: showLoading
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override
public void showLoading() {
if (builder == null) {
builder = new MaterialDialog.Builder(SearchActivity.this);
builder.cancelable(false);
builder.title("等一下");
builder.content("正在获取查询条件...").progress(true, 0);
}
materialDialog = builder.show();
}
示例7: showLoading
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override
public void showLoading() {
if (builder == null) {
builder = new MaterialDialog.Builder(InsideCheckActivity.this);
builder.cancelable(false);
builder.title("等一下");
builder.content("正在请求数据...").progress(true, 0);
}
materialDialog = builder.show();
}
示例8: showDialog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override protected void showDialog(Bundle state) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(context)
.title(getDialogTitle())
.icon(getDialogIcon())
.dismissListener(this)
.onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
switch (which) {
default:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
break;
case NEUTRAL:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
break;
case NEGATIVE:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
break;
}
}
})
.positiveText(getPositiveButtonText())
.negativeText(getNegativeButtonText())
.autoDismiss(true); // immediately close the dialog after selection
final View contentView = onCreateDialogView();
if (contentView != null) {
onBindDialogView(contentView);
builder.customView(contentView, false);
} else {
builder.content(getDialogMessage());
}
PrefUtil.registerOnActivityDestroyListener(this, this);
dialog = builder.build();
if (state != null)
dialog.onRestoreInstanceState(state);
dialog.show();
}
示例9: hideKeyboard
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public static void hideKeyboard(@NonNull final DialogInterface di,
@NonNull final MaterialDialog.Builder builder) {
final MaterialDialog dialog = (MaterialDialog) di;
if (dialog.getInputEditText() == null) return;
InputMethodManager imm = (InputMethodManager) builder.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
final View currentFocus = dialog.getCurrentFocus();
final IBinder windowToken = currentFocus != null ?
currentFocus.getWindowToken() : dialog.getView().getWindowToken();
if (windowToken != null) {
imm.hideSoftInputFromWindow(windowToken, 0);
}
}
}
示例10: start
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public AsyncTask start(@NonNull Executor executor) {
if (mDialog == null) {
int color = mWallpaper.getColor();
if (color == 0) {
color = ColorHelper.getAttributeColor(mContext.get(), R.attr.colorAccent);
}
final MaterialDialog.Builder builder = new MaterialDialog.Builder(mContext.get());
builder.widgetColor(color)
.typeface(TypefaceHelper.getMedium(mContext.get()), TypefaceHelper.getRegular(mContext.get()))
.progress(true, 0)
.cancelable(false)
.progressIndeterminateStyle(true)
.content(R.string.wallpaper_loading)
.positiveColor(color)
.positiveText(android.R.string.cancel)
.onPositive((dialog, which) -> {
ImageLoader.getInstance().stop();
cancel(true);
});
mDialog = builder.build();
}
if (!mDialog.isShowing()) mDialog.show();
mExecutor = executor;
if (mWallpaper == null) {
LogUtil.e("WallpaperApply cancelled, wallpaper is null");
return null;
}
if (mWallpaper.getDimensions() == null) {
return WallpaperPropertiesLoaderTask.prepare(mContext.get())
.wallpaper(mWallpaper)
.callback(this)
.start(AsyncTask.THREAD_POOL_EXECUTOR);
}
return executeOnExecutor(executor);
}
示例11: onCreateDialog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
builder.customView(R.layout.fragment_licenses, false);
builder.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
builder.title(R.string.about_open_source_licenses);
MaterialDialog dialog = builder.build();
dialog.show();
ButterKnife.bind(this, dialog);
return dialog;
}
示例12: confirm
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@ScriptInterface
public Object confirm(String title, String content, Object callback) {
MaterialDialog.Builder builder = dialogBuilder(callback)
.confirm()
.title(title)
.positiveText(R.string.ok)
.negativeText(R.string.cancel);
if (!TextUtils.isEmpty(content)) {
builder.content(content);
}
return ((BlockedMaterialDialog.Builder) builder).showAndGet();
}
示例13: showLoading
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public void showLoading() {
if (builder == null) {
builder = new MaterialDialog.Builder(NewOpportunityActivity.this);
builder.cancelable(false);
builder.title("等一下");
builder.content("正在请求数据...").progress(true, 0);
}
materialDialog = builder.show();
}
示例14: showLoading
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
public void showLoading() {
if (builder == null) {
builder = new MaterialDialog.Builder(mContext);
builder.cancelable(false);
builder.title("等一下");
builder.content("正在获取更新数据...").progress(true, 0);
}
materialDialog = builder.show();
}
示例15: showLoading
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override
public void showLoading() {
if (builder == null) {
builder = new MaterialDialog.Builder(ShowOpportunityActivity.this);
builder.cancelable(false);
builder.title("等一下");
builder.content("正在请求数据...").progress(true, 0);
}
materialDialog = builder.show();
}