Search in sources :

Example 1 with SettingsSubAdapter

use of me.ccrama.redditslide.Adapters.SettingsSubAdapter in project Slide by ccrama.

the class SettingsSubreddit method reloadSubList.

public void reloadSubList() {
    changedSubs.clear();
    List<String> allSubs = UserSubscriptions.sort(UserSubscriptions.getAllUserSubreddits(this));
    // Check which subreddits are different
    ColorPreferences colorPrefs = new ColorPreferences(SettingsSubreddit.this);
    int defaultFont = colorPrefs.getFontStyle().getColor();
    for (String s : allSubs) {
        if (Palette.getColor(s) != Palette.getDefaultColor() || SettingValues.prefs.contains(Reddit.PREF_LAYOUT + s) || colorPrefs.getFontStyleSubreddit(s).getColor() != defaultFont || SettingValues.prefs.contains("picsenabled" + s.toLowerCase(Locale.ENGLISH))) {
            changedSubs.add(s);
        }
    }
    mSettingsSubAdapter = new SettingsSubAdapter(this, changedSubs);
    recycler.setAdapter(mSettingsSubAdapter);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.post_floating_action_button);
    recycler.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            if (dy <= 0 && fab.getId() != 0) {
                fab.show();
            } else {
                fab.hide();
            }
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);
        }
    });
    fab.show();
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) FloatingActionButton(android.support.design.widget.FloatingActionButton) RecyclerView(android.support.v7.widget.RecyclerView) SettingsSubAdapter(me.ccrama.redditslide.Adapters.SettingsSubAdapter)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SettingsSubAdapter (me.ccrama.redditslide.Adapters.SettingsSubAdapter)1 ColorPreferences (me.ccrama.redditslide.ColorPreferences)1