當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。