Java 类com.afollestad.materialdialogs.MaterialDialog 实例源码

项目:TubiPlayer    文件:TrackSelectionHelper.java   
/**
 * Shows the selection dialog for a given renderer.
 *
 * @param rendererIndex The index of the renderer.
 * @param callback      The callback interface when the dialog is dismissed
 */
public void showSelectionDialog(int rendererIndex, @NonNull TrackSelectionHelperInterface callback) {


    this.mCallbackInterface = callback;

    qualityDialogView = new TubiQualityDialogView(mActivity);
    qualityDialogView.setAdaptiveTrackSelectionFactory(adaptiveTrackSelectionFactory);

    MaterialDialog.Builder materialBuilder = new MaterialDialog.Builder(mActivity);
    materialBuilder.customView(qualityDialogView.buildQualityDialog(selector, rendererIndex), false)
            .title(mActivity.getResources().getString(R.string.track_selector_alert_quality_title))
            .backgroundColor(mActivity.getResources().getColor(R.color.tubi_tv_steel_grey))
            .positiveText(android.R.string.ok)
            .positiveColor(mActivity.getResources().getColor(R.color.tubi_tv_golden_gate))
            .onPositive(qualityDialogView)
            .dismissListener(this)
            .show();
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:MyScriptListFragment.java   
@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();
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:MyScriptListFragment.java   
@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);
    }

}
项目:Hello-Music-droid    文件:AddPlaylistDialog.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final List<Playlist> playlists = PlaylistLoader.getPlaylists(getActivity(), false);
    CharSequence[] chars = new CharSequence[playlists.size() + 1];
    chars[0] = "Create new playlist";

    for (int i = 0; i < playlists.size(); i++) {
        chars[i + 1] = playlists.get(i).name;
    }
    return new MaterialDialog.Builder(getActivity()).title("Add to playlist").items(chars).itemsCallback(new MaterialDialog.ListCallback() {
        @Override
        public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
            long[] songs = getArguments().getLongArray("songs");
            if (which == 0) {
                CreatePlaylistDialog.newInstance(songs).show(getActivity().getSupportFragmentManager(), "CREATE_PLAYLIST");
                return;
            }

            MusicPlayer.addToPlaylist(getActivity(), songs, playlists.get(which - 1).id);
            dialog.dismiss();

        }
    }).build();
}
项目:ScanLinks    文件:MainActivity.java   
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();
}
项目:Auto.js    文件:CircularMenu.java   
@Optional
@OnClick(R.id.script_list)
void showScriptList() {
    mWindow.collapse();
    ScriptListView listView = new ScriptListView(mContext);
    listView.setStorageFileProvider(StorageFileProvider.getDefault());
    listView.setDirectorySpanSize(2);
    final MaterialDialog dialog = new ThemeColorMaterialDialogBuilder(mContext)
            .title(R.string.text_run_script)
            .customView(listView, false)
            .positiveText(R.string.cancel)
            .build();
    listView.setOnItemOperatedListener(file -> dialog.dismiss());
    listView.setOnScriptFileClickListener((view, file) -> Scripts.run(file));
    DialogUtils.showDialog(dialog);
}
项目:quire    文件:WelcomeActivity.java   
@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);
}
项目:MusicX-music-player    文件:PlayListPicker.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View rootView = LayoutInflater.from(getContext()).inflate(R.layout.playlist_picker, new LinearLayout(getContext()), false);

    rv = (RecyclerView) rootView.findViewById(R.id.rv);

    MaterialDialog.Builder pickDialog = new MaterialDialog.Builder(getContext());
    pickDialog.title(R.string.choose_playlist);
    playlistListAdapter = new PlaylistListAdapter(getContext());
    playlistListAdapter.setOnItemClickListener(onClick);
    CustomLayoutManager customLayoutManager = new CustomLayoutManager(getContext());
    customLayoutManager.setSmoothScrollbarEnabled(true);
    rv.addItemDecoration(new DividerItemDecoration(getContext(), 75, false));
    rv.setLayoutManager(customLayoutManager);
    rv.setAdapter(playlistListAdapter);
    ateKey = Helper.getATEKey(getContext());
    colorAccent = Config.accentColor(getContext(), ateKey);
    CreatePlaylist = (Button) rootView.findViewById(R.id.create_playlist);
    CreatePlaylist.setOnClickListener(mOnClickListener);
    CreatePlaylist.setBackgroundColor(colorAccent);
    pickDialog.customView(rootView, false);
    loadPlaylist();
    return pickDialog.show();
}
项目:Nearby    文件:NurseMainActivity.java   
@Override
public void onBackPressed() {
    new MaterialDialog.Builder(this)
            .title(R.string.ok)
            .content(R.string.are_you_finish_app)
            .positiveText(R.string.finish)
            .negativeText(R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.putExtra("EXIT", true);
                    startActivity(intent);
                    finish();
                }
            })
            .show();
}
项目:JKCloud    文件:InsideCheckActivity.java   
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    switch (msg.what) {
        case GET_ERROR:
        case GET_SUCCESS:
            dismissLoading();
            /*发送广播获取待审核数量*/
            Intent intent = new Intent("REFRESH_COUNT");
            sendBroadcast(intent);
            new MaterialDialog.Builder(InsideCheckActivity.this)
                    .content((String) msg.obj)
                    .title("系统提示")
                    .canceledOnTouchOutside(false)
                    .positiveText("确定")
                    .onPositive((dialog, which) -> {
                        finish();
                    })
                    .show();
            break;
        default:
            break;
    }
}
项目:QiangHongBao    文件:MainActivity.java   
private void showHintDialog() {
    PackageInfo weChat = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_WX);
    PackageInfo qq = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_QQ);
    PackageInfo tim = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_TIM);
    String msg = "";
    if(weChat != null && weChat.versionCode < WeChatConfig.V_1080){
        msg += "微信、";
    }

    if(qq != null && qq.versionCode < QQConfig.V_718){
        msg += "QQ、";
    }

    if(tim != null && tim.versionCode < TIMConfig.V_938){
        msg += "TIM、";
    }

    if (!TextUtils.isEmpty(msg)) {
        msg = msg.substring(0, msg.length() - 1);
        new MaterialDialog.Builder(this)
                .title("提示")
                .content("当前" + msg + "版本过低,可能导致抢红包失败!请及时更新到" + msg + "最新版")
                .positiveText("我知道了")
                .show();
    }
}
项目:anitrend-app    文件:SplashPresenter.java   
public void requestAppReset() {
    new DialogManager(mContext).createDialogMessage("Authentication Error", Html.fromHtml(mContext.getString(R.string.app_splash_authenticating_message)),
            mContext.getString(R.string.Yes), mContext.getString(R.string.No), new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            switch (which) {
                case POSITIVE:
                    makeAlerterInfo("Application has been reset!");
                    ServiceGenerator.authStateChange(mContext);
                    new ApplicationPrefs(mContext).setUserDeactivated();
                    mContext.onRefresh();
                    break;
                case NEGATIVE:
                    dialog.dismiss();
                    break;
            }
        }
    });
}
项目:MyAnimeViewer    文件:PlayServicesUtils.java   
/**
 * Check the device to make sure it has the Google Play Services APK. If
 * it doesn't, display a dialog that allows users to download the APK from
 * the Google Play Store or enable it in the device's system settings.
 */
public static boolean checkPlayServices(AppCompatActivity activity, int PLAY_SERVICES_RESOLUTION_REQUEST) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
                    .show();
        } else {
            MaterialDialog dialog = new MaterialDialog.Builder(activity)
                    .content("This device is not supported.")
                    .show();
        }
        return false;
    }
    return true;
}
项目:MusicX-music-player    文件:PlaylistHelper.java   
/**
 * 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();
}
项目:MusicX-music-player    文件:Helper.java   
/**
 * GuideLines Dialog
 *
 * @param context
 */
public static void GuidLines(Context context) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
    builder.title("GuideLines");
    WebView webView = new WebView(context);
    webView.loadUrl("file:///android_asset/Guidlines.html");
    builder.positiveText(android.R.string.ok);
    builder.typeface(getFont(context),getFont(context));
    builder.onPositive(new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            dialog.dismiss();
        }
    });
    builder.customView(webView, false);
    builder.build();
    builder.show();
}
项目:GitHub    文件:ColorChooserDialog.java   
@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();
    }
}
项目:JKCloud    文件:UpdateManager.java   
/**
 * 显示软件下载对话框
 */
@SuppressLint("InflateParams")
private void showDownloadDialog() {
    try {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.update, null);
        mProgress = (NumberProgressBar) v.findViewById(R.id.update_progress);
        new MaterialDialog.Builder(mContext)
                .title("正在下载")
                .customView(v, false)
                .negativeText("取消")
                .onPositive((dialog, which) -> {
                    cancelUpdate = true;
                }).show();
        downloadApk();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:QiangHongBao    文件:MainActivity.java   
private void exit() {
    if(!QHBService.isRun()){
        AppManager.getInstance().exitApp(true);
        return;
    }
    new MaterialDialog.Builder(getActivity())
            .title("退出服务")
            .content("找到[快手抢红包],然后关闭服务再退出即可")
            .negativeText("取消")
            .positiveText("确认")
            .onAny(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    switch (which) {
                        case POSITIVE:
                            getActivity().startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
                            break;
                    }

                }
            })
            .show();
}
项目:EasyAndroid    文件:AuthEditTextActivity.java   
public void onChangeTextLength(View view)
{
    new MaterialDialog.Builder(getContext())
            .items(R.array.auth_edit_text_length)
            .alwaysCallInputCallback()
            .itemsCallbackSingleChoice(0, new MaterialDialog.ListCallbackSingleChoice()
            {
                @Override
                public boolean onSelection(MaterialDialog dialog, View itemView, int which,
                                           CharSequence text)
                {
                    authEditText.setTextLength(Convert.toInt(text.toString()));
                    return true;
                }
            }).show();
}
项目:javaide    文件:DialogHelper.java   
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);
}
项目:quire    文件:UpdateUserListingActivity.java   
@Override
public void showNetworkError() {
    builder = new MaterialDialog.Builder(mContext)
            .title(R.string.all_dialog_network_error_title)
            .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);
}
项目:GitHub    文件:MainActivity.java   
@SuppressWarnings("ConstantConditions")
@OnClick(R.id.list_longPress)
public void showListLongPress() {
    index = 0;
    new MaterialDialog.Builder(this)
            .title(R.string.socialNetworks)
            .items(R.array.socialNetworks)
            .itemsCallback((dialog, view, which, text) -> showToast(which + ": " + text))
            .autoDismiss(false)
            .itemsLongCallback((dialog, itemView, position, text) -> {
                dialog.getItems().remove(position);
                dialog.notifyItemsChanged();
                return false;
            })
            .onNeutral((dialog, which) -> {
                index++;
                dialog.getItems().add("Item " + index);
                dialog.notifyItemInserted(dialog.getItems().size() - 1);
            })
            .neutralText(R.string.add_item)
            .show();
}
项目:GitHub    文件:MainActivity.java   
@OnClick(R.id.multiChoice) public void showMultiChoice() {
    new MaterialDialog.Builder(this).title(R.string.socialNetworks)
            .items(R.array.socialNetworks)
            .itemsCallbackMultiChoice(new Integer[]{1, 3}, (dialog, which, text) -> {
                StringBuilder str = new StringBuilder();
                for (int i = 0; i < which.length; i++) {
                    if (i > 0) str.append('\n');
                    str.append(which[i]);
                    str.append(": ");
                    str.append(text[i]);
                }
                showToast(str.toString());
                return true; // allow selection
            })
            .onNeutral((dialog, which) -> dialog.clearSelectedIndices())
            .onPositive((dialog, which) -> dialog.dismiss())
            .alwaysCallMultiChoiceCallback()
            .positiveText(R.string.md_choose_label)
            .autoDismiss(false)
            .neutralText(R.string.clear_selection)
            .show();
}
项目:Nearby    文件:SearchMedicineActivity.java   
public void selectMedicine(final Medicine medicine){

        String content = "";
        content = "이 약을 새롭게 추가하겠습니까?\n\n" +
                "약명 : " + medicine.getName() + "\n" +
                "보험코드 : " + medicine.getCode() + "\n" +
                "제조회사 : " + medicine.getCompany() + "\n" +
                "용량 : " + medicine.getStandard() + medicine.getUnit();

        new MaterialDialog.Builder(this)
                .title(R.string.ok)
                .content(content)
                .positiveText(R.string.ok)
                .negativeText(R.string.cancel)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        Intent intent = new Intent();
                        intent.putExtra("medicine", medicine);
                        setResult(SELECTED_MEDICINE, intent);
                        finish();
                    }
                })
                .show();

    }
项目:GitHub    文件:MainActivity.java   
@OnClick(R.id.themed) public void showThemed() {
    new MaterialDialog.Builder(this)
            .title(R.string.useGoogleLocationServices)
            .content(R.string.useGoogleLocationServicesPrompt)
            .positiveText(R.string.agree)
            .negativeText(R.string.disagree)
            .positiveColorRes(R.color.material_red_400)
            .negativeColorRes(R.color.material_red_400)
            .titleGravity(GravityEnum.CENTER)
            .titleColorRes(R.color.material_red_400)
            .contentColorRes(android.R.color.white)
            .backgroundColorRes(R.color.material_blue_grey_800)
            .dividerColorRes(R.color.accent)
            .btnSelector(R.drawable.md_btn_selector_custom, DialogAction.POSITIVE)
            .positiveColor(Color.WHITE)
            .negativeColorAttr(android.R.attr.textColorSecondaryInverse)
            .theme(Theme.DARK)
            .show();
}
项目:wallpaperboard    文件:LicenseCallbackHelper.java   
private void showLicenseDialog(LicenseHelper.Status status) {
    int message = status == LicenseHelper.Status.SUCCESS ?
            R.string.license_check_success : R.string.license_check_failed;
    new MaterialDialog.Builder(mContext)
            .typeface(TypefaceHelper.getMedium(mContext), TypefaceHelper.getRegular(mContext))
            .title(R.string.license_check)
            .content(message)
            .positiveText(R.string.close)
            .onPositive((dialog, which) -> {
                onLicenseChecked(status);
                dialog.dismiss();
            })
            .cancelable(false)
            .canceledOnTouchOutside(false)
            .show();
}
项目:GitHub    文件:MainActivity.java   
@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();
}
项目:FriendBook    文件:BookCatalogActivity.java   
private void showSectionSelectionDialog() {
    if (dialog == null) {
        RecyclerView recyclerView = new RecyclerView(this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.addItemDecoration(new RecyclerViewItemDecoration.Builder(this)
                .color(ContextCompat.getColor(this, R.color.colorDivider))
                .thickness(1)
                .create());
        recyclerView.setAdapter(sectionAdapter);
        dialog = new MaterialDialog.Builder(this)
                .customView(recyclerView, true)
                .build();
    } else {
        sectionAdapter.notifyDataSetChanged();
    }
    dialog.show();

}
项目:RetroMusicPlayer    文件:ClearSmartPlaylistDialog.java   
@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();
}
项目:FriendBook    文件:BookcaseFragment.java   
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();
}
项目:Orin    文件:DonationsDialog.java   
@Override
protected void onPostExecute(List<SkuDetails> skuDetails) {
    super.onPostExecute(skuDetails);
    DonationsDialog dialog = donationDialogWeakReference.get();
    if (dialog == null) return;

    if (skuDetails == null || skuDetails.isEmpty()) {
        dialog.dismiss();
        return;
    }

    View customView = ((MaterialDialog) dialog.getDialog()).getCustomView();
    //noinspection ConstantConditions
    customView.findViewById(R.id.progress_container).setVisibility(View.GONE);
    ListView listView = ButterKnife.findById(customView, R.id.list);
    listView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails));
    listView.setVisibility(View.VISIBLE);
}
项目:Clipcon-AndroidClient    文件:GroupActivity.java   
@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();
}
项目:Nearby    文件:BaseActivity.java   
public void logout(Activity activity){

        new MaterialDialog.Builder(activity)
                .title(R.string.ok)
                .content(R.string.are_you_sure_logout)
                .positiveText(R.string.logout)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        SharedPreferences.Editor editor = getSharedPreferences("setting", 0).edit();
                        editor.putString("login_id", null);
                        editor.putString("login_pw", null);
                        editor.putBoolean("isEmployee", false);
                        editor.commit();

                        StartActivity.initLoginData();
                        Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);
                        finish();
                    }
                })
                .negativeText(R.string.cancel)
                .show();

    }
项目:anitrend-app    文件:MainActivity.java   
/**
 * When Material Dialog on click occurs
 */
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {

    if(mNavigationIndex == R.id.nav_anime || mNavigationIndex == R.id.nav_manga || mNavigationIndex == R.id.nav_myanime || mNavigationIndex == R.id.nav_mymanga || mNavigationIndex == R.id.nav_hub) {
        mPresenter.createSuperToast(MainActivity.this,
                getString(R.string.text_filter_applying),
                R.drawable.ic_reset,
                Style.TYPE_PROGRESS_BAR, Style.DURATION_VERY_SHORT,
                PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN));
    } else {
        mPresenter.createSuperToast(MainActivity.this,
                getString(R.string.text_filter_restriction),
                R.drawable.ic_info_outline_white_18dp,
                Style.TYPE_STANDARD, Style.DURATION_VERY_SHORT,
                PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_ORANGE));
    }
}
项目:Nearby    文件:AdminMainActivity.java   
@Override
public void onBackPressed() {
    new MaterialDialog.Builder(this)
            .title(R.string.ok)
            .content(R.string.are_you_finish_app)
            .positiveText(R.string.finish)
            .negativeText(R.string.cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.putExtra("EXIT", true);
                    startActivity(intent);
                    finish();
                }
            })
            .show();
}
项目:order-by-android    文件:ActivityLogin.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Pega o ID do item selecionado no Popup Menu
    int id = item.getItemId();

    // Verifica qual item foi selecionado e faz sua ação
    if (id == R.id.action_sobre) {
        new MaterialDialog.Builder(ActivityLogin.this)
                .title("Ajuda")
                .content("O RM é composto por uma letra verificadora (L, C ou T), seguida pelos dois ultimos dígitos do ano da matrícula e a posição.\n\n" +
                        "Exemplo: L150001")
                .positiveText("OK")
                .show();

    } else if (id == R.id.action_pref) {
        //Inicia a tela de Configurações
        startActivity(new Intent(this, SettingsActivity.class));
    }

    return super.onOptionsItemSelected(item);
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:MaterialDialogFactory.java   
public static MaterialDialog createProgress(Context context) {
    return new MaterialDialog.Builder(context)
            .progress(true, 0)
            .cancelable(false)
            .content(R.string.text_processing)
            .build();
}
项目:Nearby    文件:EmployeeDetailActivity.java   
private void initProgressDialog(){
    if(progressDialog != null){
        progressDialog.dismiss();
    }
    progressDialog = new MaterialDialog.Builder(this)
            .content(R.string.please_wait)
            .progress(true, 0)
            .progressIndeterminateStyle(true)
            .theme(Theme.LIGHT)
            .cancelable(false)
            .build();
}
项目:SaveIg    文件:DialogHelper.java   
static void showHowToDialog(final Context context) {
    new MaterialStyledDialog.Builder(context)
            .setStyle(Style.HEADER_WITH_TITLE)
            .setTitle(R.string.how_to_title)
            .setDescription(R.string.how_to_message)
            .setPositiveText(R.string.how_to_close)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.hide();
                }
            })
            .build()
            .show();
}
项目:Auto.js    文件:AboutActivity.java   
private void crashTest() {
    new ThemeColorMaterialDialogBuilder(this)
            .title("Crash Test")
            .positiveText("Crash")
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    throw new RuntimeException("Crash Test");
                }
            }).show();
}