Search in sources :

Example 6 with ColorPreferences

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

the class BaseActivity method applyColorTheme.

/**
 * Applies the activity's base color theme based on the theme of a specific subreddit. Should be
 * called before inflating any layouts.
 *
 * @param subreddit The subreddit to base the theme on
 */
protected void applyColorTheme(String subreddit) {
    getTheme().applyStyle(new FontPreferences(this).getPostFontStyle().getResId(), true);
    getTheme().applyStyle(new ColorPreferences(this).getThemeSubreddit(subreddit), true);
    getTheme().applyStyle(new FontPreferences(this).getCommentFontStyle().getResId(), true);
}
Also used : FontPreferences(me.ccrama.redditslide.Visuals.FontPreferences) ColorPreferences(me.ccrama.redditslide.ColorPreferences)

Example 7 with ColorPreferences

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

the class Album method onCreate.

public void onCreate(Bundle savedInstanceState) {
    overrideSwipeFromAnywhere();
    super.onCreate(savedInstanceState);
    getTheme().applyStyle(new ColorPreferences(this).getDarkThemeSubreddit(ColorPreferences.FONT_STYLE), true);
    setContentView(R.layout.album);
    // Keep the screen on
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    if (getIntent().hasExtra(SUBREDDIT)) {
        this.subreddit = getIntent().getExtras().getString(SUBREDDIT);
    }
    final ViewPager pager = (ViewPager) findViewById(R.id.images);
    album = new OverviewPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(album);
    pager.setCurrentItem(1);
    pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            if (position == 0 && positionOffsetPixels == 0) {
                finish();
            }
            if (position == 0 && ((OverviewPagerAdapter) pager.getAdapter()).blankPage != null) {
                if (((OverviewPagerAdapter) pager.getAdapter()).blankPage != null) {
                    ((OverviewPagerAdapter) pager.getAdapter()).blankPage.doOffset(positionOffset);
                }
                ((OverviewPagerAdapter) pager.getAdapter()).blankPage.realBack.setBackgroundColor(adjustAlpha(positionOffset * 0.7f));
            }
        }

        @Override
        public void onPageSelected(int position) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    if (!Reddit.appRestart.contains("tutorialSwipe")) {
        startActivityForResult(new Intent(this, SwipeTutorial.class), 3);
    }
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) Intent(android.content.Intent) ViewPager(android.support.v4.view.ViewPager)

Example 8 with ColorPreferences

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

the class AlbumPager method onCreate.

public void onCreate(Bundle savedInstanceState) {
    overrideSwipeFromAnywhere();
    super.onCreate(savedInstanceState);
    getTheme().applyStyle(new ColorPreferences(this).getDarkThemeSubreddit(ColorPreferences.FONT_STYLE), true);
    setContentView(R.layout.album_pager);
    // Keep the screen on
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    if (getIntent().hasExtra(SUBREDDIT)) {
        this.subreddit = getIntent().getStringExtra(SUBREDDIT);
    }
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle(R.string.type_album);
    ToolbarColorizeHelper.colorizeToolbar(mToolbar, Color.WHITE, this);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mToolbar.setPopupTheme(new ColorPreferences(this).getDarkThemeSubreddit(ColorPreferences.FONT_STYLE));
    adapterPosition = getIntent().getIntExtra(MediaView.ADAPTER_POSITION, -1);
    String url = getIntent().getExtras().getString("url", "");
    setShareUrl(url);
    pagerLoad = new LoadIntoPager(url, this);
    pagerLoad.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    if (!Reddit.appRestart.contains("tutorialSwipe")) {
        startActivityForResult(new Intent(this, SwipeTutorial.class), 3);
    }
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) Intent(android.content.Intent)

Example 9 with ColorPreferences

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

the class ModQueue method onCreate.

@Override
public void onCreate(Bundle savedInstance) {
    overrideSwipeFromAnywhere();
    super.onCreate(savedInstance);
    applyColorTheme("");
    setContentView(R.layout.activity_inbox);
    setupAppBar(R.id.toolbar, R.string.drawer_moderation, true, true);
    TabLayout tabs = (TabLayout) findViewById(R.id.sliding_tabs);
    tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    tabs.setSelectedTabIndicatorColor(new ColorPreferences(ModQueue.this).getColor("no sub"));
    final View header = findViewById(R.id.header);
    ViewPager pager = (ViewPager) findViewById(R.id.content_view);
    pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            header.animate().translationY(0).setInterpolator(new LinearInterpolator()).setDuration(180);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    findViewById(R.id.header).setBackgroundColor(Palette.getDefaultColor());
    pager.setAdapter(new OverviewPagerAdapter(getSupportFragmentManager()));
    tabs.setupWithViewPager(pager);
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) LinearInterpolator(android.view.animation.LinearInterpolator) TabLayout(android.support.design.widget.TabLayout) View(android.view.View) ViewPager(android.support.v4.view.ViewPager)

Example 10 with ColorPreferences

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

the class MultiredditOverview method onCreate.

@Override
public void onCreate(Bundle savedInstance) {
    overrideSwipeFromAnywhere();
    super.onCreate(savedInstance);
    applyColorTheme("");
    setContentView(R.layout.activity_multireddits);
    setupAppBar(R.id.toolbar, R.string.title_multireddits, true, false);
    findViewById(R.id.header).setBackgroundColor(Palette.getDefaultColor());
    tabs = (TabLayout) findViewById(R.id.sliding_tabs);
    tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    pager = (ViewPager) findViewById(R.id.content_view);
    mToolbar.setPopupTheme(new ColorPreferences(this).getFontStyle().getBaseId());
    profile = "";
    if (getIntent().getExtras() != null) {
        profile = getIntent().getExtras().getString(EXTRA_PROFILE, "");
    }
    if (profile.equalsIgnoreCase(Authentication.name)) {
        profile = "";
    }
    UserSubscriptions.MultiCallback callback = new UserSubscriptions.MultiCallback() {

        @Override
        public void onComplete(List<MultiReddit> multiReddits) {
            if (multiReddits != null && !multiReddits.isEmpty()) {
                setDataSet(multiReddits);
            } else {
                buildDialog();
            }
        }
    };
    if (profile.isEmpty()) {
        UserSubscriptions.getMultireddits(callback);
    } else {
        UserSubscriptions.getPublicMultireddits(callback, profile);
    }
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) CaseInsensitiveArrayList(me.ccrama.redditslide.CaseInsensitiveArrayList) List(java.util.List) ArrayList(java.util.ArrayList) UserSubscriptions(me.ccrama.redditslide.UserSubscriptions)

Aggregations

ColorPreferences (me.ccrama.redditslide.ColorPreferences)50 View (android.view.View)23 TextView (android.widget.TextView)22 Intent (android.content.Intent)16 DialogInterface (android.content.DialogInterface)14 AlertDialogWrapper (com.afollestad.materialdialogs.AlertDialogWrapper)14 ArrayList (java.util.ArrayList)14 SpoilerRobotoTextView (me.ccrama.redditslide.SpoilerRobotoTextView)13 LayoutInflater (android.view.LayoutInflater)12 RecyclerView (android.support.v7.widget.RecyclerView)10 ImageView (android.widget.ImageView)10 SubmissionsView (me.ccrama.redditslide.Fragments.SubmissionsView)10 Context (android.content.Context)9 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)9 HorizontalScrollView (android.widget.HorizontalScrollView)9 Snackbar (android.support.design.widget.Snackbar)8 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)8 CaseInsensitiveArrayList (me.ccrama.redditslide.CaseInsensitiveArrayList)8 LinearInterpolator (android.view.animation.LinearInterpolator)7 Dialog (android.app.Dialog)6