Search in sources :

Example 6 with CaseInsensitiveArrayList

use of me.ccrama.redditslide.CaseInsensitiveArrayList in project Slide by ccrama.

the class Login method doSubStrings.

private void doSubStrings(ArrayList<Subreddit> subs) {
    subNames = new CaseInsensitiveArrayList();
    for (Subreddit s : subs) {
        subNames.add(s.getDisplayName().toLowerCase(Locale.ENGLISH));
    }
    subNames = UserSubscriptions.sort(subNames);
    if (!subNames.contains("slideforreddit")) {
        new AlertDialogWrapper.Builder(Login.this).setTitle(R.string.login_subscribe_rslideforreddit).setMessage(R.string.login_subscribe_rslideforreddit_desc).setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                subNames.add(2, "slideforreddit");
                UserSubscriptions.setSubscriptions(subNames);
                Reddit.forceRestart(Login.this, true);
            }
        }).setNegativeButton(R.string.btn_no, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                UserSubscriptions.setSubscriptions(subNames);
                Reddit.forceRestart(Login.this, true);
            }
        }).setCancelable(false).show();
    } else {
        UserSubscriptions.setSubscriptions(subNames);
        Reddit.forceRestart(Login.this, true);
    }
}
Also used : DialogInterface(android.content.DialogInterface) CaseInsensitiveArrayList(me.ccrama.redditslide.CaseInsensitiveArrayList) Subreddit(net.dean.jraw.models.Subreddit)

Aggregations

CaseInsensitiveArrayList (me.ccrama.redditslide.CaseInsensitiveArrayList)6 DialogInterface (android.content.DialogInterface)2 View (android.view.View)2 TextView (android.widget.TextView)2 ColorPreferences (me.ccrama.redditslide.ColorPreferences)2 MultiReddit (net.dean.jraw.models.MultiReddit)2 MultiSubreddit (net.dean.jraw.models.MultiSubreddit)2 Intent (android.content.Intent)1 Drawable (android.graphics.drawable.Drawable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 LinearLayout (android.widget.LinearLayout)1 DialogAction (com.afollestad.materialdialogs.DialogAction)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 FloatingActionButton (com.getbase.floatingactionbutton.FloatingActionButton)1 FloatingActionsMenu (com.getbase.floatingactionbutton.FloatingActionsMenu)1 MultiredditView (me.ccrama.redditslide.Fragments.MultiredditView)1 Subreddit (net.dean.jraw.models.Subreddit)1