com.afollestad.materialdialogs.Theme Java Examples

The following examples show how to use com.afollestad.materialdialogs.Theme. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HelpDialog.java    From Focus with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("InflateParams")
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final View customView;
        try {
            customView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_help_view, null);
        } catch (InflateException e) {
            throw new IllegalStateException("This device does not support Web Views.");
        }
        MaterialDialog dialog =
                new MaterialDialog.Builder(getActivity())
                        .theme(getArguments().getBoolean("dark_theme") ? Theme.DARK : Theme.LIGHT)
                        .title("帮助信息")
                        .customView(customView, false)
                        .positiveText(android.R.string.ok)
                        .build();

        final WebView webView = customView.findViewById(R.id.webview);
//        webView.loadData(this.content, "text/html", "UTF-8");
        WebViewUtil.LoadHtmlIntoWebView(webView,this.content,getActivity(),"");
        return dialog;
    }
 
Example #2
Source File: LoadFolderSpaceData.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
private void updateChart(String totalSpace, List<PieEntry> entries) {
    boolean isDarkTheme = appTheme.getMaterialDialogTheme() == Theme.DARK;

    PieDataSet set = new PieDataSet(entries, null);
    set.setColors(COLORS);
    set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
    set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
    set.setSliceSpace(5f);
    set.setAutomaticallyDisableSliceSpacing(true);
    set.setValueLinePart2Length(1.05f);
    set.setSelectionShift(0f);

    PieData pieData = new PieData(set);
    pieData.setValueFormatter(new GeneralDialogCreation.SizeFormatter(context));
    pieData.setValueTextColor(isDarkTheme? Color.WHITE:Color.BLACK);

    chart.setCenterText(new SpannableString(context.getString(R.string.total) + "\n" + totalSpace));
    chart.setData(pieData);
}
 
Example #3
Source File: UI.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
public static MaterialDialog.Builder popup(final Activity a, final String title, final int pos, final int neg) {
    final MaterialDialog.Builder b;
    b = new MaterialDialog.Builder(a)
        .title(title)
        .titleColorRes(R.color.white)
        .positiveColor(ThemeUtils.resolveColorAccent(a))
        .negativeColor(ThemeUtils.resolveColorAccent(a))
        .contentColorRes(R.color.white)
        .backgroundColor(a.getResources().getColor(R.color.buttonJungleGreen))
        .theme(Theme.DARK);
    if (pos != INVALID_RESOURCE_ID)
        b.positiveText(pos);
    if (neg != INVALID_RESOURCE_ID)
        return b.negativeText(neg);
    return b;
}
 
Example #4
Source File: HelpDialog.java    From Focus with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("InflateParams")
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final View customView;
        try {
            customView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_help_view, null);
        } catch (InflateException e) {
            throw new IllegalStateException("This device does not support Web Views.");
        }
        MaterialDialog dialog =
                new MaterialDialog.Builder(getActivity())
                        .theme(getArguments().getBoolean("dark_theme") ? Theme.DARK : Theme.LIGHT)
                        .title("帮助信息")
                        .customView(customView, false)
                        .positiveText(android.R.string.ok)
                        .build();

        final WebView webView = customView.findViewById(R.id.webview);
//        webView.loadData(this.content, "text/html", "UTF-8");
        WebViewUtil.LoadHtmlIntoWebView(webView,this.content,getActivity(),"");
        return dialog;
    }
 
Example #5
Source File: FlowerOptionsDialog.java    From Zen with GNU General Public License v2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog materialDialog = new MaterialDialog.Builder(getActivity())
            .title(ContextRetriever.INSTANCE.getResources().getString(R.string.flower_options_title))
            .backgroundColor(Color.WHITE)
            .customView(R.layout.flowers_options_dialog, false)
            .positiveText(ContextRetriever.INSTANCE.getResources().getString(R.string.option_done))
            .positiveColorRes(R.color.colorPrimaryDark)
            .negativeText(ContextRetriever.INSTANCE.getResources().getString(R.string.option_cancel))
            .negativeColorRes(R.color.colorAccent)
            .theme(Theme.LIGHT)
            .onPositive((dialog, which) -> {
                if (hasFlowerSelectedListener()) {
                    flowerSelectedListener.onFlowerSelected(selectedFlower);
                }
                trackPreferences();
                storePreferences();
            })
            .build();

    FlowerViewList flowerViewList = materialDialog.getCustomView().findViewById(R.id.flower_picker);
    flowerViewList.setFlowerSelectedListener(this);

    return materialDialog;
}
 
Example #6
Source File: BrushOptionsDialog.java    From Zen with GNU General Public License v2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog materialDialog = new MaterialDialog.Builder(getActivity())
            .title(ContextRetriever.INSTANCE.getResources().getString(R.string.brush_options_title))
            .backgroundColor(Color.WHITE)
            .customView(R.layout.brush_options_dialog, false)
            .positiveText(ContextRetriever.INSTANCE.getResources().getString(R.string.option_done))
            .positiveColorRes(R.color.colorPrimaryDark)
            .negativeText(ContextRetriever.INSTANCE.getResources().getString(R.string.option_cancel))
            .negativeColorRes(R.color.colorAccent)
            .theme(Theme.LIGHT)
            .onPositive((dialog, which) -> {
                trackPreferences();
                storePreferences();
            })
            .build();

    ColorListView colorListView = materialDialog.getCustomView().findViewById(R.id.color_picker);
    colorListView.setColorSelectedListener(this);

    sizeView = materialDialog.getCustomView().findViewById(R.id.brush_size);
    sizeView.setSizeChangedListener(this);

    return materialDialog;
}
 
Example #7
Source File: SearchActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemLongClick(View view, final int position) {
    new MaterialDialog.Builder(this)
            .onPositive((ignored1, ignored2) -> {
                GlobalConfig.deleteSearchHistory(historyList.get(position));
                refreshHistoryList();
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .title(getResources().getString(R.string.dialog_content_delete_one_search_record))
            .content(historyList.get(position))
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_likethis)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
Example #8
Source File: MainActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onPostExecute(Void v) {
    Context context = contextReference.get();
    if (context == null) return;

    // check whether there's new version
    int current = BuildConfig.VERSION_CODE;
    Log.d("MewX", "current version code: " + current);
    if (current < newVersionCode) {
        // update to new version
        new MaterialDialog.Builder(context)
                .theme(Theme.LIGHT)
                .title(R.string.system_update_found_new)
                .content(R.string.system_update_jump_to_page)
                .positiveText(R.string.dialog_positive_sure)
                .negativeText(R.string.dialog_negative_no)
                .negativeColorRes(R.color.menu_text_color)
                .onPositive((dialog, which) -> {
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(GlobalConfig.blogPageUrl));
                    context.startActivity(browserIntent);
                })
                .show();

    }
}
 
Example #9
Source File: VerticalReaderActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
private void getNovelContent() {
    ContentValues cv = Wenku8API.getNovelContent(aid, cid, GlobalConfig.getCurrentLang());

    final asyncNovelContentTask ast = new asyncNovelContentTask();
    ast.execute(cv);

    pDialog = new MaterialDialog.Builder(this)
            .theme(Theme.LIGHT)
            .title(R.string.sorry_old_engine_preprocess)
            .content(R.string.sorry_old_engine_merging)
            .progress(false, 1, true)
            .cancelable(true)
            .cancelListener(dialog -> {
                ast.cancel(true);
                pDialog.dismiss();
                pDialog = null;
            })
            .titleColorRes(R.color.default_text_color_black)
            .show();

    pDialog.setProgress(0);
    pDialog.setMaxProgress(1);
    pDialog.show();
}
 
Example #10
Source File: FavFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();

    loadAllLocal();

    isLoading = true;
    md = new MaterialDialog.Builder(getActivity())
            .theme(Theme.LIGHT)
            .content(R.string.dialog_content_sync)
            .progress(false, 1, true)
            .cancelable(true)
            .cancelListener(dialog -> {
                isLoading = false;
                md.dismiss();
            })
            .show();
    md.setProgress(0);
    md.setMaxProgress(0);
    md.show();
}
 
Example #11
Source File: ConfigFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    Context ctx = contextWeakReference.get();
    if (ctx != null) {
        md = new MaterialDialog.Builder(Objects.requireNonNull(ctx))
                .theme(Theme.LIGHT)
                .cancelListener(dialog -> {
                    isLoading = false;
                    AsyncDeleteSlow.this.cancel(true);
                })
                .title(R.string.config_clear_cache)
                .content(R.string.dialog_content_wipe_cache_slow)
                .progress(true, 0)
                .cancelable(true)
                .show();
    }
    isLoading = true;
}
 
Example #12
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 0 <string name="dialog_option_check_for_update">检查更新</string>
 */
private void optionCheckUpdates() {
    new MaterialDialog.Builder(NovelInfoActivity.this)
            .onPositive((ignored1, ignored2) -> {
                // async task
                isLoading = true;
                final AsyncUpdateCacheTask auct = new AsyncUpdateCacheTask();
                auct.execute(aid, 0);

                // show progress
                pDialog = new MaterialDialog.Builder(NovelInfoActivity.this)
                        .theme(Theme.LIGHT)
                        .content(R.string.dialog_content_downloading)
                        .progress(false, 1, true)
                        .cancelable(true)
                        .cancelListener(dialog12 -> {
                            isLoading = false;
                            auct.cancel(true);
                            pDialog.dismiss();
                            pDialog = null;
                        })
                        .show();

                pDialog.setProgress(0);
                pDialog.setMaxProgress(1);
                pDialog.show();
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .content(R.string.dialog_content_verify_update)
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_likethis)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
Example #13
Source File: UserInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();

    md = new MaterialDialog.Builder(UserInfoActivity.this)
            .theme(Theme.LIGHT)
            .content(R.string.system_fetching)
            .progress(true, 0)
            .cancelable(false)
            .show();
}
 
Example #14
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 1 <string name="dialog_option_update_uncached_volumes">更新下载</string>
 */
private void optionDownloadUpdates() {
    new MaterialDialog.Builder(NovelInfoActivity.this)
            .onPositive((ignored1, ignored2) -> {
                // async task
                isLoading = true;
                final AsyncUpdateCacheTask auct = new AsyncUpdateCacheTask();
                auct.execute(aid, 1);

                // show progress
                pDialog = new MaterialDialog.Builder(NovelInfoActivity.this)
                        .theme(Theme.LIGHT)
                        .content(R.string.dialog_content_downloading)
                        .progress(false, 1, true)
                        .cancelable(true)
                        .cancelListener(dialog1 -> {
                            isLoading = false;
                            auct.cancel(true);
                            pDialog.dismiss();
                            pDialog = null;
                        })
                        .show();

                pDialog.setProgress(0);
                pDialog.setMaxProgress(1);
                pDialog.show();
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .content(R.string.dialog_content_verify_download)
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_likethis)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
Example #15
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 2 <string name="dialog_option_force_update_all">覆盖下载</string>
 */
private void optionDownloadOverride() {
    new MaterialDialog.Builder(NovelInfoActivity.this)
            .onPositive((ignored1, ignored2) -> {
                // async task
                isLoading = true;
                final AsyncUpdateCacheTask auct = new AsyncUpdateCacheTask();
                auct.execute(aid, 2);

                // show progress
                pDialog = new MaterialDialog.Builder(NovelInfoActivity.this)
                        .theme(Theme.LIGHT)
                        .content(R.string.dialog_content_downloading)
                        .progress(false, 1, true)
                        .cancelable(true)
                        .cancelListener(dialog13 -> {
                            isLoading = false;
                            auct.cancel(true);
                            pDialog.dismiss();
                            pDialog = null;
                        })
                        .show();

                pDialog.setProgress(0);
                pDialog.setMaxProgress(1);
                pDialog.show();
            })
            .theme(Theme.LIGHT)
            .backgroundColorRes(R.color.dlgBackgroundColor)
            .contentColorRes(R.color.dlgContentColor)
            .positiveColorRes(R.color.dlgPositiveButtonColor)
            .negativeColorRes(R.color.dlgNegativeButtonColor)
            .content(R.string.dialog_content_verify_force_update)
            .contentGravity(GravityEnum.CENTER)
            .positiveText(R.string.dialog_positive_likethis)
            .negativeText(R.string.dialog_negative_preferno)
            .show();
}
 
Example #16
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 3 <string name="dialog_option_select_and_update">分卷下载</string>
 */
private void optionDownloadSelected() {
    // select volumes
    String[] strings = new String[listVolume.size()];
    for(int i = 0; i < listVolume.size(); i ++)
        strings[i] = listVolume.get(i).volumeName;

    new MaterialDialog.Builder(NovelInfoActivity.this)
            .theme(Theme.LIGHT)
            .title(R.string.dialog_option_select_and_update)
            .items(strings)
            .itemsCallbackMultiChoice(null, (dialog, which, text) -> {
                if(which == null || which.length == 0) return true;

                // show verify dialog
                new MaterialDialog.Builder(NovelInfoActivity.this)
                        .onPositive((ignored1, ignored2) -> {
                            AsyncDownloadVolumes adv = new AsyncDownloadVolumes();
                            adv.execute(which);
                        })
                        .theme(Theme.LIGHT)
                        .backgroundColorRes(R.color.dlgBackgroundColor)
                        .contentColorRes(R.color.dlgContentColor)
                        .positiveColorRes(R.color.dlgPositiveButtonColor)
                        .negativeColorRes(R.color.dlgNegativeButtonColor)
                        .content(R.string.dialog_content_verify_download)
                        .contentGravity(GravityEnum.CENTER)
                        .positiveText(R.string.dialog_positive_likethis)
                        .negativeText(R.string.dialog_negative_preferno)
                        .show();
                return true;
            })
            .positiveText(R.string.dialog_positive_ok)
            .show();
}
 
Example #17
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    md = new MaterialDialog.Builder(NovelInfoActivity.this)
            .theme(Theme.LIGHT)
            .content(R.string.dialog_content_novel_remove_from_cloud)
            .contentColorRes(R.color.dlgContentColor)
            .progress(true, 0)
            .show();
}
 
Example #18
Source File: NovelInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    loading = true;
    md = new MaterialDialog.Builder(NovelInfoActivity.this)
            .theme(Theme.LIGHT)
            .content(R.string.dialog_content_downloading)
            .progress(false, 1, true)
            .cancelable(true)
            .cancelListener(dialog -> loading = false)
            .show();
    md.setProgress(0);
    md.setMaxProgress(1);
    size_a = 0;
}
 
Example #19
Source File: UserLoginActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    md = new MaterialDialog.Builder(UserLoginActivity.this)
            .theme(Theme.LIGHT)
            .content(R.string.system_logging_in)
            .progress(true, 0)
            .show();
}
 
Example #20
Source File: UserInfoActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();

    operation = 0; // init
    md = new MaterialDialog.Builder(UserInfoActivity.this)
            .theme(Theme.LIGHT)
            .content(R.string.system_fetching)
            .progress(true, 0)
            .cancelable(false)
            .show();
}
 
Example #21
Source File: Wenku8ReaderActivityV1.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
private void gotoPreviousPage() {
    if(mSlidingPageAdapter != null && !mSlidingPageAdapter.hasPrevious()) {
        // goto previous chapter
        for (int i = 0; i < volumeList.chapterList.size(); i++) {
            if (cid == volumeList.chapterList.get(i).cid) {
                // found self
                if (i == 0) {
                    // no more previous
                    Toast.makeText(Wenku8ReaderActivityV1.this, getResources().getString(R.string.reader_already_first_chapter), Toast.LENGTH_SHORT).show();
                } else {
                    // jump to previous
                    final int i_bak = i;
                    new MaterialDialog.Builder(Wenku8ReaderActivityV1.this)
                            .onPositive((dialog, which) -> {
                                Intent intent = new Intent(Wenku8ReaderActivityV1.this, Wenku8ReaderActivityV1.class); //VerticalReaderActivity.class);
                                intent.putExtra("aid", aid);
                                intent.putExtra("volume", volumeList);
                                intent.putExtra("cid", volumeList.chapterList.get(i_bak - 1).cid);
                                intent.putExtra("from", from); // from cloud
                                startActivity(intent);
                                overridePendingTransition(R.anim.fade_in, R.anim.hold); // fade in animation
                                Wenku8ReaderActivityV1.this.finish();
                            })
                            .theme(WenkuReaderPageView.getInDayMode() ? Theme.LIGHT : Theme.DARK)
                            .title(R.string.dialog_sure_to_jump_chapter)
                            .content(volumeList.chapterList.get(i_bak - 1).chapterName)
                            .contentGravity(GravityEnum.CENTER)
                            .positiveText(R.string.dialog_positive_yes)
                            .negativeText(R.string.dialog_negative_no)
                            .show();
                }
                break;
            }
        }
    }
    else {
        if(sl != null)
            sl.slidePrevious();
    }
}
 
Example #22
Source File: Wenku8ReaderActivityV1.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
private void gotoNextPage() {
    if(mSlidingPageAdapter != null && !mSlidingPageAdapter.hasNext()) {
        // goto next chapter
        for (int i = 0; i < volumeList.chapterList.size(); i++) {
            if (cid == volumeList.chapterList.get(i).cid) {
                // found self
                if (i + 1 >= volumeList.chapterList.size()) {
                    // no more previous
                    Toast.makeText(Wenku8ReaderActivityV1.this, getResources().getString(R.string.reader_already_last_chapter), Toast.LENGTH_SHORT).show();
                } else {
                    // jump to previous
                    final int i_bak = i;
                    new MaterialDialog.Builder(Wenku8ReaderActivityV1.this)
                            .onPositive((dialog, which) -> {
                                Intent intent = new Intent(Wenku8ReaderActivityV1.this, Wenku8ReaderActivityV1.class); //VerticalReaderActivity.class);
                                intent.putExtra("aid", aid);
                                intent.putExtra("volume", volumeList);
                                intent.putExtra("cid", volumeList.chapterList.get(i_bak + 1).cid);
                                intent.putExtra("from", from); // from cloud
                                startActivity(intent);
                                overridePendingTransition(R.anim.fade_in, R.anim.hold); // fade in animation
                                Wenku8ReaderActivityV1.this.finish();
                            })
                            .theme(WenkuReaderPageView.getInDayMode() ? Theme.LIGHT : Theme.DARK)
                            .title(R.string.dialog_sure_to_jump_chapter)
                            .content(volumeList.chapterList.get(i_bak + 1).chapterName)
                            .contentGravity(GravityEnum.CENTER)
                            .positiveText(R.string.dialog_positive_yes)
                            .negativeText(R.string.dialog_negative_no)
                            .show();
                }
                break;
            }
        }
    }
    else {
        if(sl != null)
            sl.slideNext();
    }
}
 
Example #23
Source File: Wenku8ReaderActivityV1.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    md = new MaterialDialog.Builder(Wenku8ReaderActivityV1.this)
            .theme(WenkuReaderPageView.getInDayMode() ? Theme.LIGHT : Theme.DARK)
            .title(R.string.reader_please_wait)
            .content(R.string.reader_engine_v1_parsing)
            .progress(true, 0)
            .cancelable(false)
            .show();
}
 
Example #24
Source File: ConfigFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPostExecute(Integer code) {
    super.onPostExecute(code);

    Context ctx = contextWeakReference.get();
    if (ctx == null) return;

    if (code == -1)
        Toast.makeText(ctx, ctx.getResources().getString(R.string.system_update_timeout), Toast.LENGTH_SHORT).show();

    int current = BuildConfig.VERSION_CODE;
    if (current >= code) {
        Toast.makeText(ctx, ctx.getResources().getString(R.string.system_update_latest_version), Toast.LENGTH_SHORT).show();
    } else {
        // update to new version
        new MaterialDialog.Builder(ctx)
                .theme(Theme.LIGHT)
                .title(R.string.system_update_found_new)
                .content(R.string.system_update_jump_to_page)
                .positiveText(R.string.dialog_positive_sure)
                .negativeText(R.string.dialog_negative_biao)
                .onPositive((dialog, which) -> {
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(GlobalConfig.blogPageUrl));
                    ctx.startActivity(browserIntent);
                })
                .show();
    }
}
 
Example #25
Source File: ConfigFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    Context ctx = contextWeakReference.get();
    if (ctx != null) {
        md = new MaterialDialog.Builder(ctx)
                .theme(Theme.LIGHT)
                .title(R.string.config_clear_cache)
                .content(R.string.dialog_content_wipe_cache_fast)
                .progress(true, 0)
                .cancelable(false)
                .show();
    }
}
 
Example #26
Source File: FavFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    md = new MaterialDialog.Builder(getActivity())
            .theme(Theme.LIGHT)
            .content(R.string.dialog_content_novel_remove_from_cloud)
            .contentColorRes(R.color.dlgContentColor)
            .progress(true, 0)
            .show();
}
 
Example #27
Source File: ImageToolbarActivity.java    From Bangumi-Android with MIT License 5 votes vote down vote up
private void initProgressDialog() {
    mProgressDialog = new MaterialDialog
            .Builder(this)
            .content(getString(R.string.dialog_ep_updating))
            .progress(true, 0)
            .theme(Theme.LIGHT)
            .cancelable(false)
            .build();
}
 
Example #28
Source File: LoginFragment.java    From Bangumi-Android with MIT License 5 votes vote down vote up
private void initProgressDialog() {
    mProgressDialog = new MaterialDialog
            .Builder(getActivity())
            .content(getString(R.string.dialog_logining))
            .progress(true, 0)
            .theme(Theme.LIGHT)
            .cancelable(false)
            .build();
}
 
Example #29
Source File: UI.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public static MaterialDialog.Builder popup(final Activity a, final String title, final int pos, final int neg) {
    final MaterialDialog.Builder b;
    b = new MaterialDialog.Builder(a)
            .title(title)
            .titleColorRes(R.color.white)
            .positiveColorRes(R.color.accent)
            .negativeColorRes(R.color.accent)
            .contentColorRes(R.color.white)
            .theme(Theme.DARK);
    if (pos != INVALID_RESOURCE_ID)
        b.positiveText(pos);
    if (neg != INVALID_RESOURCE_ID)
        return b.negativeText(neg);
    return b;
}
 
Example #30
Source File: SignUpActivity.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
private void onNfcSignupButtonClicked() {
    if (mNfcDialog == null) {
        mNfcDialog = new MaterialDialog.Builder(SignUpActivity.this)
            .title(R.string.nfcDialogMessage)
            .customView(mNfcView, true)
            .titleColorRes(R.color.white)
            .contentColorRes(android.R.color.white)
            .theme(Theme.DARK).build();
        UI.setDialogCloseHandler(mNfcDialog, mNfcDialogCB, true /* cancelOnly */);
    }
    mWriteMode = true;
    mNfcDialog.show();
}