@Override protected void initTheme(int themeId) { switch (themeId) { case Constant.DAY_TIME: mCollLayout.setBackgroundColor(ResUtil.getColor(R.color.red_bg)); mBackgroundLayout.setBackgroundColor(ResUtil.getColor(R.color.colorPrimary)); break; case Constant.NIGHT: mCollLayout.setBackgroundColor(ResUtil.getColor(R.color.red_text_bg)); mBackgroundLayout.setBackgroundColor(ResUtil.getColor(R.color.background_night)); break; default: break; } }
@Override protected void initTheme(int themeId) { switch (themeId) { case Constant.DAY_TIME: mCollLayout.setBackgroundColor(ResUtil.getColor(R.color.colorPrimary)); mBackgroundLayout.setBackgroundColor(ResUtil.getColor(R.color.colorPrimary)); break; case Constant.NIGHT: mCollLayout.setBackgroundColor(ResUtil.getColor(R.color.hotpage_sentences_night_bg)); mBackgroundLayout.setBackgroundColor(ResUtil.getColor(R.color.hotpage_sentences_night_bg)); break; default: break; } }
@Override public void onGenerated(Palette palette) { Palette.Swatch swatch = palette.getVibrantSwatch(); if (swatch != null) { mToolbarLayout.setBackgroundColor(swatch.getRgb()); mToolbarLayout.setContentScrimColor(swatch.getRgb()); mToolbarLayout.setCollapsedTitleTextColor(swatch.getTitleTextColor()); mToolbarLayout.setStatusBarScrimColor(deeper(swatch.getRgb())); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { Window window = mActivity.getWindow(); window.setStatusBarColor(deeper(swatch.getRgb())); window.setNavigationBarColor(deeper(swatch.getRgb())); } } } });
collapsingAvatarToolbar.setBackgroundColor(getResources().getColor(R.color.theme_color)); collapsingAvatarToolbar.setExpandedTitleGravity(Gravity.CENTER_VERTICAL); collapsingAvatarToolbar.setExpandedTitleColor(getResources().getColor(R.color.theme_color));
private void updatePaletteColorViews(Palette palette) { if (palette.getDarkVibrantSwatch() != null) { mRelativeLayout.setBackgroundColor(palette.getDarkVibrantSwatch().getRgb()); mCircularProgressBar.setBackgroundColor(palette.getDarkVibrantSwatch().getRgb()); colorView.setBackgroundColor(palette.getDarkVibrantSwatch().getRgb()); collapsingToolbarLayout.setBackgroundColor(palette.getDarkVibrantSwatch().getRgb()); collapsingToolbarLayout.setStatusBarScrimColor(palette.getDarkVibrantSwatch().getRgb()); collapsingToolbarLayout.setContentScrimColor(palette.getDarkVibrantSwatch().getRgb()); } else if (palette.getMutedSwatch() != null) { mRelativeLayout.setBackgroundColor(palette.getMutedSwatch().getRgb()); mCircularProgressBar.setBackgroundColor(palette.getMutedSwatch().getRgb()); colorView.setBackgroundColor(palette.getMutedSwatch().getRgb()); collapsingToolbarLayout.setBackgroundColor(palette.getMutedSwatch().getRgb()); collapsingToolbarLayout.setStatusBarScrimColor(palette.getMutedSwatch().getRgb()); collapsingToolbarLayout.setContentScrimColor(palette.getMutedSwatch().getRgb()); } LayerDrawable stars = (LayerDrawable) ratingBar.getProgressDrawable(); if (palette.getLightVibrantSwatch() != null) { mCircularProgressBar.setColor(palette.getLightVibrantSwatch().getRgb()); stars.getDrawable(2).setColorFilter(palette.getLightVibrantSwatch().getRgb(), PorterDuff.Mode.SRC_ATOP); } else if (palette.getLightMutedSwatch() != null) { mCircularProgressBar.setColor(palette.getLightMutedSwatch().getRgb()); stars.getDrawable(2).setColorFilter(palette.getLightMutedSwatch().getRgb(), PorterDuff.Mode.SRC_ATOP); } } }
toolbar.setBackgroundColor(vibrantSwatch.getRgb()); toolbar.setContentScrimColor(vibrantSwatch.getRgb()); if (vibrantSwatch.getRgb() == Color.TRANSPARENT && mutedSwatch != null) { toolbar.setBackgroundColor(mutedSwatch.getRgb()); toolbar.setContentScrimColor(mutedSwatch.getRgb());