Material-dialogs: how to use by java ,how to upgrade from com.afollestad.material-dialogs:commons:0.9.0.2

Created on 20 Sep 2019  Â·  2Comments  Â·  Source: afollestad/material-dialogs

Please consider making a Pull Request if you are capable of doing so.

I need to update a lot of code to make the project work properly, but I don't know how to modify it, and the new version is kotin, which is more painful for me.

What module does this apply to?
example

 MaterialDialog.Builder builder = new MaterialDialog.Builder(context)
                .title(getDialogTitle())
                .icon(getDialogIcon())

                .dismissListener(this)
                .onAny(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick( MaterialDialog dialog, DialogAction which) {
                        switch (which) {
                            default:
                                MaterialListPreferenceX.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                                break;
                            case NEUTRAL:
                                MaterialListPreferenceX.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
                                break;
                            case NEGATIVE:
                                MaterialListPreferenceX.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
                                break;
                        }
                    }
                })
                .negativeText(getNegativeButtonText())
                .items(getEntries())
                .autoDismiss(true) // immediately close the dialog after selection
                .itemsCallbackSingleChoice(preselect, new MaterialDialog.ListCallbackSingleChoice() {
                    @Override
                    public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
                        onClick(null, DialogInterface.BUTTON_POSITIVE);
                        if (which >= 0 && getEntryValues() != null) {
                            try {
                                Field clickedIndex = ListPreference.class.getDeclaredField("mClickedDialogEntryIndex");
                                clickedIndex.setAccessible(true);
                                clickedIndex.set(MaterialListPreferenceX.this, which);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                        return true;
                    }
                });

How to turn into a new version of Java code?

Most helpful comment

sad

All 2 comments

Java isn't supported.

1879 #1864 #1848 #1822

sad

Was this page helpful?
0 / 5 - 0 ratings

Related issues

palaima picture palaima  Â·  4Comments

eygraber picture eygraber  Â·  3Comments

timbremer picture timbremer  Â·  6Comments

ghost1372 picture ghost1372  Â·  5Comments

Supercaly picture Supercaly  Â·  3Comments