当前位置: 首页>>代码示例>>Java>>正文


Java MaterialDialog类代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.MaterialDialog的典型用法代码示例。如果您正苦于以下问题:Java MaterialDialog类的具体用法?Java MaterialDialog怎么用?Java MaterialDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MaterialDialog类属于com.afollestad.materialdialogs包,在下文中一共展示了MaterialDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exit

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
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();
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:24,代码来源:MainActivity.java

示例2: showSelectionDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:25,代码来源:TrackSelectionHelper.java

示例3: deleteScriptFile

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的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

示例4: onInput

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的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

示例5: onCreateDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
@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();
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:27,代码来源:AddPlaylistDialog.java

示例6: showFirstRunDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的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();
}
 
开发者ID:theblixguy,项目名称:ScanLinks,代码行数:18,代码来源:MainActivity.java

示例7: showScriptList

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
@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);
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:17,代码来源:CircularMenu.java

示例8: show500ServerError

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的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);
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:20,代码来源:WelcomeActivity.java

示例9: onCreateDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
@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();
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:26,代码来源:PlayListPicker.java

示例10: onBackPressed

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
@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();
}
 
开发者ID:pooi,项目名称:Nearby,代码行数:20,代码来源:NurseMainActivity.java

示例11: handleMessage

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:25,代码来源:InsideCheckActivity.java

示例12: showHintDialog

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
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();
    }
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:27,代码来源:MainActivity.java

示例13: requestAppReset

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
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;
            }
        }
    });
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:20,代码来源:SplashPresenter.java

示例14: checkPlayServices

import com.afollestad.materialdialogs.MaterialDialog; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:22,代码来源:PlayServicesUtils.java

示例15: 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();
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:24,代码来源:PlaylistHelper.java


注:本文中的com.afollestad.materialdialogs.MaterialDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。