use of me.ccrama.redditslide.ColorPreferences in project Slide by ccrama.
the class SubredditView method doSubSidebarNoLoad.
public void doSubSidebarNoLoad(final String subOverride) {
findViewById(R.id.loader).setVisibility(View.GONE);
invalidateOptionsMenu();
if (!subOverride.equalsIgnoreCase("all") && !subOverride.equalsIgnoreCase("frontpage") && !subOverride.equalsIgnoreCase("friends") && !subOverride.equalsIgnoreCase("mod") && !subOverride.contains("+") && !subOverride.contains(".") && !subOverride.contains("/m/")) {
if (drawerLayout != null) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END);
}
findViewById(R.id.sidebar_text).setVisibility(View.GONE);
findViewById(R.id.sub_title).setVisibility(View.GONE);
findViewById(R.id.subscribers).setVisibility(View.GONE);
findViewById(R.id.active_users).setVisibility(View.GONE);
findViewById(R.id.header_sub).setBackgroundColor(Palette.getColor(subOverride));
((TextView) findViewById(R.id.sub_infotitle)).setText(subOverride);
// Sidebar buttons should use subOverride's accent color
int subColor = new ColorPreferences(this).getColor(subOverride);
((TextView) findViewById(R.id.theme_text)).setTextColor(subColor);
((TextView) findViewById(R.id.wiki_text)).setTextColor(subColor);
((TextView) findViewById(R.id.post_text)).setTextColor(subColor);
((TextView) findViewById(R.id.mods_text)).setTextColor(subColor);
((TextView) findViewById(R.id.flair_text)).setTextColor(subColor);
((TextView) findViewById(R.id.sorting).findViewById(R.id.sort)).setTextColor(subColor);
((TextView) findViewById(R.id.sync)).setTextColor(subColor);
} else {
if (drawerLayout != null) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END);
}
}
}
use of me.ccrama.redditslide.ColorPreferences in project Slide by ccrama.
the class Tumblr 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);
final ViewPager pager = (ViewPager) findViewById(R.id.images);
album = new OverviewPagerAdapter(getSupportFragmentManager());
pager.setAdapter(album);
pager.setCurrentItem(1);
if (getIntent().hasExtra(SUBREDDIT)) {
subreddit = getIntent().getStringExtra(SUBREDDIT);
}
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);
}
}
use of me.ccrama.redditslide.ColorPreferences in project Slide by ccrama.
the class TumblrPager 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);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitle(R.string.type_album);
ToolbarColorizeHelper.colorizeToolbar(mToolbar, Color.WHITE, this);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (getIntent().hasExtra(SUBREDDIT)) {
this.subreddit = getIntent().getStringExtra(SUBREDDIT);
}
mToolbar.setPopupTheme(new ColorPreferences(this).getDarkThemeSubreddit(ColorPreferences.FONT_STYLE));
adapterPosition = getIntent().getIntExtra(MediaView.ADAPTER_POSITION, -1);
String url = getIntent().getExtras().getString("url", "");
setShareUrl(url);
new LoadIntoPager(url, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (!Reddit.appRestart.contains("tutorialSwipe")) {
startActivityForResult(new Intent(this, SwipeTutorial.class), 3);
}
}
use of me.ccrama.redditslide.ColorPreferences in project Slide by ccrama.
the class Tutorial method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getTheme().applyStyle(new FontPreferences(this).getCommentFontStyle().getResId(), true);
getTheme().applyStyle(new FontPreferences(this).getPostFontStyle().getResId(), true);
getTheme().applyStyle(new ColorPreferences(this).getFontStyle().getBaseId(), true);
setContentView(R.layout.activity_tutorial);
// Instantiate a ViewPager and a PagerAdapter.
mPager = (ViewPager) findViewById(R.id.vp);
/*
The pager adapter, which provides the pages to the view pager widget.
*/
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
if (getIntent().hasExtra("page")) {
mPager.setCurrentItem(1);
}
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);
window.setStatusBarColor(Palette.getDarkerColor(Color.parseColor("#FF5252")));
}
}
use of me.ccrama.redditslide.ColorPreferences in project Slide by ccrama.
the class MultiredditOverview method setDataSet.
private void setDataSet(List<MultiReddit> data) {
try {
usedArray = data;
if (usedArray.isEmpty()) {
buildDialog();
} else {
if (adapter == null) {
adapter = new OverviewPagerAdapter(getSupportFragmentManager());
} else {
adapter.notifyDataSetChanged();
}
pager.setAdapter(adapter);
pager.setOffscreenPageLimit(1);
tabs.setupWithViewPager(pager);
tabs.setSelectedTabIndicatorColor(new ColorPreferences(MultiredditOverview.this).getColor(usedArray.get(0).getDisplayName()));
doDrawerSubs(0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = this.getWindow();
window.setStatusBarColor(Palette.getDarkerColor(usedArray.get(0).getDisplayName()));
}
final View header = findViewById(R.id.header);
tabs.setOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
@Override
public void onTabReselected(TabLayout.Tab tab) {
super.onTabReselected(tab);
int[] firstVisibleItems;
int pastVisiblesItems = 0;
firstVisibleItems = ((CatchStaggeredGridLayoutManager) (((MultiredditView) adapter.getCurrentFragment()).rv.getLayoutManager())).findFirstVisibleItemPositions(null);
if (firstVisibleItems != null && firstVisibleItems.length > 0) {
for (int firstVisibleItem : firstVisibleItems) {
pastVisiblesItems = firstVisibleItem;
}
}
if (pastVisiblesItems > 8) {
((MultiredditView) adapter.getCurrentFragment()).rv.scrollToPosition(0);
if (header != null) {
header.animate().translationY(header.getHeight()).setInterpolator(new LinearInterpolator()).setDuration(0);
}
} else {
((MultiredditView) adapter.getCurrentFragment()).rv.smoothScrollToPosition(0);
}
}
});
findViewById(R.id.header).setBackgroundColor(Palette.getColor(usedArray.get(0).getDisplayName()));
}
} catch (NullPointerException e) {
buildDialog(true);
Log.e(LogUtil.getTag(), "Cannot load multis:\n" + e);
}
}
Aggregations