Search in sources :

Example 1 with Subreddit

use of net.dean.jraw.models.Subreddit in project Slide by ccrama.

the class Crosspost method onCreate.

public void onCreate(Bundle savedInstanceState) {
    disableSwipeBackLayout();
    super.onCreate(savedInstanceState);
    applyColorTheme();
    setContentView(R.layout.activity_crosspost);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = this.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    setupAppBar(R.id.toolbar, R.string.title_crosspost, true, true);
    inboxReplies = (SwitchCompat) findViewById(R.id.replies);
    final AutoCompleteTextView subredditText = ((AutoCompleteTextView) findViewById(R.id.subreddittext));
    ((EditText) findViewById(R.id.crossposttext)).setText(toCrosspost.getTitle() + getString(R.string.submission_properties_seperator) + "/u/" + toCrosspost.getAuthor());
    findViewById(R.id.crossposttext).setEnabled(false);
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, UserSubscriptions.getAllSubreddits(this));
    subredditText.setAdapter(adapter);
    subredditText.setThreshold(2);
    subredditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (tchange != null) {
                tchange.cancel(true);
            }
            findViewById(R.id.submittext).setVisibility(View.GONE);
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    subredditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            findViewById(R.id.submittext).setVisibility(View.GONE);
            if (!hasFocus) {
                tchange = new AsyncTask<Void, Void, Subreddit>() {

                    @Override
                    protected Subreddit doInBackground(Void... params) {
                        try {
                            return Authentication.reddit.getSubreddit(subredditText.getText().toString());
                        } catch (Exception ignored) {
                        }
                        return null;
                    }

                    @Override
                    protected void onPostExecute(Subreddit s) {
                        if (s != null) {
                            String text = s.getDataNode().get("submit_text_html").asText();
                            if (text != null && !text.isEmpty() && !text.equals("null")) {
                                findViewById(R.id.submittext).setVisibility(View.VISIBLE);
                                setViews(text, subredditText.getText().toString(), (SpoilerRobotoTextView) findViewById(R.id.submittext), (CommentOverflow) findViewById(R.id.commentOverflow));
                            }
                            if (s.getSubredditType().equals("RESTRICTED")) {
                                subredditText.setText("");
                                new AlertDialogWrapper.Builder(Crosspost.this).setTitle(R.string.err_submit_restricted).setMessage(R.string.err_submit_restricted_text).setPositiveButton(R.string.btn_ok, null).show();
                            }
                        } else {
                            findViewById(R.id.submittext).setVisibility(View.GONE);
                        }
                    }
                };
                tchange.execute();
            }
        }
    });
    ((EditText) findViewById(R.id.titletext)).setText(toCrosspost.getTitle());
    findViewById(R.id.suggest).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ((EditText) findViewById(R.id.titletext)).setText(toCrosspost.getTitle());
        }
    });
    findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ((FloatingActionButton) findViewById(R.id.send)).hide();
            new AsyncDo().execute();
        }
    });
}
Also used : Window(android.view.Window) EditText(android.widget.EditText) AsyncTask(android.os.AsyncTask) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) ApiException(net.dean.jraw.ApiException) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) Subreddit(net.dean.jraw.models.Subreddit) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 2 with Subreddit

use of net.dean.jraw.models.Subreddit in project Slide by ccrama.

the class Submit method onCreate.

public void onCreate(Bundle savedInstanceState) {
    disableSwipeBackLayout();
    super.onCreate(savedInstanceState);
    applyColorTheme();
    setContentView(R.layout.activity_submit);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = this.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    setupAppBar(R.id.toolbar, R.string.title_submit_post, true, true);
    inboxReplies = (SwitchCompat) findViewById(R.id.replies);
    Intent intent = getIntent();
    final String subreddit = intent.getStringExtra(EXTRA_SUBREDDIT);
    self = findViewById(R.id.selftext);
    final AutoCompleteTextView subredditText = ((AutoCompleteTextView) findViewById(R.id.subreddittext));
    image = findViewById(R.id.image);
    link = findViewById(R.id.url);
    image.setVisibility(View.GONE);
    link.setVisibility(View.GONE);
    if (subreddit != null && !subreddit.equals("frontpage") && !subreddit.equals("all") && !subreddit.equals("friends") && !subreddit.equals("mod") && !subreddit.contains("/m/") && !subreddit.contains("+")) {
        subredditText.setText(subreddit);
    }
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, UserSubscriptions.getAllSubreddits(this));
    subredditText.setAdapter(adapter);
    subredditText.setThreshold(2);
    subredditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (tchange != null) {
                tchange.cancel(true);
            }
            findViewById(R.id.submittext).setVisibility(View.GONE);
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    subredditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            findViewById(R.id.submittext).setVisibility(View.GONE);
            if (!hasFocus) {
                tchange = new AsyncTask<Void, Void, Subreddit>() {

                    @Override
                    protected Subreddit doInBackground(Void... params) {
                        try {
                            return Authentication.reddit.getSubreddit(subredditText.getText().toString());
                        } catch (Exception ignored) {
                        }
                        return null;
                    }

                    @Override
                    protected void onPostExecute(Subreddit s) {
                        if (s != null) {
                            String text = s.getDataNode().get("submit_text_html").asText();
                            if (text != null && !text.isEmpty() && !text.equals("null")) {
                                findViewById(R.id.submittext).setVisibility(View.VISIBLE);
                                setViews(text, subredditText.getText().toString(), (SpoilerRobotoTextView) findViewById(R.id.submittext), (CommentOverflow) findViewById(R.id.commentOverflow));
                            }
                            if (s.getSubredditType().equals("RESTRICTED")) {
                                subredditText.setText("");
                                new AlertDialogWrapper.Builder(Submit.this).setTitle(R.string.err_submit_restricted).setMessage(R.string.err_submit_restricted_text).setPositiveButton(R.string.btn_ok, null).show();
                            }
                        } else {
                            findViewById(R.id.submittext).setVisibility(View.GONE);
                        }
                    }
                };
                tchange.execute();
            }
        }
    });
    findViewById(R.id.selftextradio).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            self.setVisibility(View.VISIBLE);
            image.setVisibility(View.GONE);
            link.setVisibility(View.GONE);
        }
    });
    findViewById(R.id.imageradio).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            self.setVisibility(View.GONE);
            image.setVisibility(View.VISIBLE);
            link.setVisibility(View.GONE);
        }
    });
    findViewById(R.id.linkradio).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            self.setVisibility(View.GONE);
            image.setVisibility(View.GONE);
            link.setVisibility(View.VISIBLE);
        }
    });
    findViewById(R.id.suggest).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AsyncTask<String, Void, String>() {

                Dialog d;

                @Override
                protected String doInBackground(String... params) {
                    try {
                        return TitleExtractor.getPageTitle(params[0]);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    return null;
                }

                @Override
                protected void onPreExecute() {
                    d = new MaterialDialog.Builder(Submit.this).progress(true, 100).title(R.string.editor_finding_title).content(R.string.misc_please_wait).show();
                }

                @Override
                protected void onPostExecute(String s) {
                    if (s != null) {
                        ((EditText) findViewById(R.id.titletext)).setText(s);
                        d.dismiss();
                    } else {
                        d.dismiss();
                        new AlertDialogWrapper.Builder(Submit.this).setTitle(R.string.title_not_found).setPositiveButton(R.string.btn_ok, null).show();
                    }
                }
            }.execute(((EditText) findViewById(R.id.urltext)).getText().toString());
        }
    });
    findViewById(R.id.selImage).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            TedBottomPicker tedBottomPicker = new TedBottomPicker.Builder(Submit.this).setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {

                @Override
                public void onImageSelected(List<Uri> uri) {
                    handleImageIntent(uri);
                }
            }).setLayoutResource(R.layout.image_sheet_dialog).setTitle("Choose a photo").create();
            tedBottomPicker.show(getSupportFragmentManager());
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(findViewById(R.id.bodytext).getWindowToken(), 0);
        }
    });
    DoEditorActions.doActions(((EditText) findViewById(R.id.bodytext)), findViewById(R.id.selftext), getSupportFragmentManager(), Submit.this, null, null);
    if (intent.hasExtra(Intent.EXTRA_TEXT) && !intent.getExtras().getString(Intent.EXTRA_TEXT, "").isEmpty()) {
        String data = intent.getStringExtra(Intent.EXTRA_TEXT);
        if (data.contains("\n")) {
            ((EditText) findViewById(R.id.titletext)).setText(data.substring(0, data.indexOf("\n")));
            ((EditText) findViewById(R.id.urltext)).setText(data.substring(data.indexOf("\n"), data.length()));
        } else {
            ((EditText) findViewById(R.id.urltext)).setText(data);
        }
        self.setVisibility(View.GONE);
        image.setVisibility(View.GONE);
        link.setVisibility(View.VISIBLE);
        ((RadioButton) findViewById(R.id.linkradio)).setChecked(true);
    } else if (intent.hasExtra(Intent.EXTRA_STREAM)) {
        final Uri imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
        if (imageUri != null) {
            handleImageIntent(new ArrayList<Uri>() {

                {
                    add(imageUri);
                }
            });
            self.setVisibility(View.GONE);
            image.setVisibility(View.VISIBLE);
            link.setVisibility(View.GONE);
            ((RadioButton) findViewById(R.id.imageradio)).setChecked(true);
        }
    }
    if (intent.hasExtra(Intent.EXTRA_SUBJECT) && !intent.getExtras().getString(Intent.EXTRA_SUBJECT, "").isEmpty()) {
        String data = intent.getStringExtra(Intent.EXTRA_SUBJECT);
        ((EditText) findViewById(R.id.titletext)).setText(data);
    }
    findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ((FloatingActionButton) findViewById(R.id.send)).hide();
            new AsyncDo().execute();
        }
    });
}
Also used : ArrayList(java.util.ArrayList) InputMethodManager(android.view.inputmethod.InputMethodManager) Uri(android.net.Uri) AlertDialogWrapper(com.afollestad.materialdialogs.AlertDialogWrapper) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Dialog(android.app.Dialog) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) Window(android.view.Window) EditText(android.widget.EditText) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) AsyncTask(android.os.AsyncTask) Intent(android.content.Intent) RadioButton(android.widget.RadioButton) ImageView(android.widget.ImageView) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) ApiException(net.dean.jraw.ApiException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) Subreddit(net.dean.jraw.models.Subreddit) TedBottomPicker(gun0912.tedbottompicker.TedBottomPicker) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 3 with Subreddit

use of net.dean.jraw.models.Subreddit in project Slide by ccrama.

the class ReorderSubreddits method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    disableSwipeBackLayout();
    super.onCreate(savedInstanceState);
    applyColorTheme();
    setContentView(R.layout.activity_sort);
    setupAppBar(R.id.toolbar, R.string.settings_manage_subscriptions, false, true);
    mToolbar.setPopupTheme(new ColorPreferences(this).getFontStyle().getBaseId());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    isSubscribed = new HashMap<>();
    if (Authentication.isLoggedIn) {
        new AsyncTask<Void, Void, Void>() {

            boolean success = true;

            @Override
            protected Void doInBackground(Void... params) {
                ArrayList<Subreddit> subs = new ArrayList<>();
                UserSubredditsPaginator p = new UserSubredditsPaginator(Authentication.reddit, "subscriber");
                try {
                    while (p.hasNext()) {
                        subs.addAll(p.next());
                    }
                } catch (Exception e) {
                    success = false;
                    return null;
                }
                for (Subreddit s : subs) {
                    isSubscribed.put(s.getDisplayName().toLowerCase(Locale.ENGLISH), true);
                }
                if (UserSubscriptions.multireddits == null) {
                    UserSubscriptions.loadMultireddits();
                }
                return null;
            }

            @Override
            protected void onPostExecute(Void aVoid) {
                if (success) {
                    d.dismiss();
                    doShowSubs();
                } else {
                    new AlertDialogWrapper.Builder(ReorderSubreddits.this).setTitle(R.string.err_title).setMessage(R.string.misc_please_try_again_soon).setCancelable(false).setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            finish();
                        }
                    }).show();
                }
            }

            Dialog d;

            @Override
            protected void onPreExecute() {
                d = new MaterialDialog.Builder(ReorderSubreddits.this).progress(true, 100).content(R.string.misc_please_wait).title(R.string.reorder_loading_title).cancelable(false).show();
            }
        }.execute();
    } else {
        doShowSubs();
    }
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ColorPreferences(me.ccrama.redditslide.ColorPreferences) DialogInterface(android.content.DialogInterface) CaseInsensitiveArrayList(me.ccrama.redditslide.CaseInsensitiveArrayList) ArrayList(java.util.ArrayList) UserSubredditsPaginator(net.dean.jraw.paginators.UserSubredditsPaginator) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Dialog(android.app.Dialog) MultiSubreddit(net.dean.jraw.models.MultiSubreddit) Subreddit(net.dean.jraw.models.Subreddit)

Example 4 with Subreddit

use of net.dean.jraw.models.Subreddit in project Slide by ccrama.

the class SettingsSubreddit method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    applyColorTheme();
    setContentView(R.layout.activity_settings_subreddit);
    SettingsTheme.changed = true;
    setupAppBar(R.id.toolbar, R.string.title_subreddit_settings, true, true);
    recycler = ((RecyclerView) findViewById(R.id.subslist));
    recycler.setLayoutManager(new LinearLayoutManager(this));
    reloadSubList();
    findViewById(R.id.reset).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialogWrapper.Builder(SettingsSubreddit.this).setTitle(R.string.clear_all_sub_themes).setMessage(R.string.clear_all_sub_themes_msg).setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    for (String s : changedSubs) {
                        Palette.removeColor(s);
                        SettingValues.prefs.edit().remove(Reddit.PREF_LAYOUT + s).apply();
                        new ColorPreferences(SettingsSubreddit.this).removeFontStyle(s);
                        SettingValues.resetPicsEnabled(s);
                    }
                    reloadSubList();
                }
            }).setNegativeButton(R.string.btn_no, null).show();
        }
    });
    findViewById(R.id.post_floating_action_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final ArrayList<String> subs = UserSubscriptions.sort(UserSubscriptions.getSubscriptions(SettingsSubreddit.this));
            final CharSequence[] subsAsChar = subs.toArray(new CharSequence[subs.size()]);
            MaterialDialog.Builder builder = new MaterialDialog.Builder(SettingsSubreddit.this);
            builder.title(R.string.dialog_choose_subreddits_to_edit).items(subsAsChar).itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {

                @Override
                public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
                    ArrayList<String> selectedSubs = new ArrayList<>();
                    for (int i : which) {
                        selectedSubs.add(subsAsChar[i].toString());
                    }
                    if (mSettingsSubAdapter != null)
                        mSettingsSubAdapter.prepareAndShowSubEditor(selectedSubs);
                    return true;
                }
            }).positiveText(R.string.btn_select).negativeText(R.string.btn_cancel).show();
        }
    });
    findViewById(R.id.color).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (Authentication.isLoggedIn) {
                new AlertDialogWrapper.Builder(SettingsSubreddit.this).setTitle(R.string.dialog_color_sync_title).setMessage(R.string.dialog_color_sync_message).setPositiveButton(R.string.misc_continue, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        final MaterialDialog d = new MaterialDialog.Builder(SettingsSubreddit.this).title(R.string.general_sub_sync).content(R.string.misc_please_wait).progress(false, 100).cancelable(false).show();
                        new AsyncTask<Void, Void, Void>() {

                            @Override
                            protected Void doInBackground(Void... params) {
                                ArrayList<Subreddit> subColors = UserSubscriptions.syncSubredditsGetObject();
                                d.setMaxProgress(subColors.size());
                                int i = 0;
                                done = 0;
                                for (Subreddit s : subColors) {
                                    if (s.getDataNode().has("key_color") && !s.getDataNode().get("key_color").asText().isEmpty() && Palette.getColor(s.getDisplayName().toLowerCase(Locale.ENGLISH)) == Palette.getDefaultColor()) {
                                        Palette.setColor(s.getDisplayName().toLowerCase(Locale.ENGLISH), GetClosestColor.getClosestColor(s.getDataNode().get("key_color").asText(), SettingsSubreddit.this));
                                        done++;
                                    }
                                    d.setProgress(i);
                                    i++;
                                    if (i == d.getMaxProgress()) {
                                        d.dismiss();
                                    }
                                }
                                return null;
                            }

                            @Override
                            protected void onPostExecute(Void aVoid) {
                                reloadSubList();
                                Resources res = getResources();
                                new AlertDialogWrapper.Builder(SettingsSubreddit.this).setTitle(R.string.color_sync_complete).setMessage(res.getQuantityString(R.plurals.color_sync_colored, done, done)).setPositiveButton(getString(R.string.btn_ok), null).show();
                            }
                        }.execute();
                        d.show();
                    }
                }).setNegativeButton(R.string.btn_cancel, null).show();
            } else {
                Snackbar s = Snackbar.make(mToolbar, R.string.err_color_sync_login, Snackbar.LENGTH_SHORT);
                View view = s.getView();
                TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
                tv.setTextColor(Color.WHITE);
                s.show();
            }
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) AlertDialogWrapper(com.afollestad.materialdialogs.AlertDialogWrapper) TextView(android.widget.TextView) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ColorPreferences(me.ccrama.redditslide.ColorPreferences) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) Resources(android.content.res.Resources) Subreddit(net.dean.jraw.models.Subreddit) Snackbar(android.support.design.widget.Snackbar)

Example 5 with Subreddit

use of net.dean.jraw.models.Subreddit in project Slide by ccrama.

the class UserSubscriptions method addSubsToHistory.

// Sets a list of subreddits as "searched for", will apply to all accounts
public static void addSubsToHistory(ArrayList<Subreddit> s2) {
    String history = subscriptions.getString("subhistory", "").toLowerCase(Locale.ENGLISH);
    for (Subreddit s : s2) {
        if (!history.contains(s.getDisplayName().toLowerCase(Locale.ENGLISH))) {
            history += "," + s.getDisplayName().toLowerCase(Locale.ENGLISH);
        }
    }
    subscriptions.edit().putString("subhistory", history).apply();
}
Also used : MultiSubreddit(net.dean.jraw.models.MultiSubreddit) Subreddit(net.dean.jraw.models.Subreddit)

Aggregations

Subreddit (net.dean.jraw.models.Subreddit)9 ArrayList (java.util.ArrayList)5 View (android.view.View)4 ApiException (net.dean.jraw.ApiException)4 MultiSubreddit (net.dean.jraw.models.MultiSubreddit)4 DialogInterface (android.content.DialogInterface)3 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)3 SpoilerRobotoTextView (me.ccrama.redditslide.SpoilerRobotoTextView)3 UserSubredditsPaginator (net.dean.jraw.paginators.UserSubredditsPaginator)3 Dialog (android.app.Dialog)2 Intent (android.content.Intent)2 AsyncTask (android.os.AsyncTask)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 Window (android.view.Window)2 ArrayAdapter (android.widget.ArrayAdapter)2 AutoCompleteTextView (android.widget.AutoCompleteTextView)2 EditText (android.widget.EditText)2 AlertDialogWrapper (com.afollestad.materialdialogs.AlertDialogWrapper)2