com.danimahardhika.android.helpers.core.ColorHelper Java Examples
The following examples show how to use
com.danimahardhika.android.helpers.core.ColorHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WallpaperBoardPreviewActivity.java From wallpaperboard with Apache License 2.0 | 6 votes |
private void initBottomPanel(int color) { mName.setText(mWallpaper.getName()); mName.setTextColor(color); mAuthor.setText(mWallpaper.getAuthor()); mAuthor.setTextColor(ColorHelper.setColorAlpha(color, 0.7f)); mMenuPreview.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_preview_full, color)); mMenuSave.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_download, color)); mMenuApply.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_apply_options, color)); if (getResources().getBoolean(R.bool.enable_wallpaper_download)) { mMenuSave.setVisibility(View.VISIBLE); } mMenuPreview.setOnClickListener(this); mMenuSave.setOnClickListener(this); mMenuApply.setOnClickListener(this); mMenuPreview.setOnLongClickListener(this); mMenuSave.setOnLongClickListener(this); mMenuApply.setOnLongClickListener(this); }
Example #2
Source File: CandyBarWallpaperActivity.java From candybar-library with Apache License 2.0 | 6 votes |
private void initBottomBar() { mName.setText(mWallpaper.getName()); mName.setTextColor(Color.WHITE); mAuthor.setText(mWallpaper.getAuthor()); mAuthor.setTextColor(ColorHelper.setColorAlpha(Color.WHITE, 0.7f)); mMenuSave.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_download, Color.WHITE)); mMenuApply.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_apply_options, Color.WHITE)); if (getResources().getBoolean(R.bool.enable_wallpaper_download)) { mMenuSave.setVisibility(View.VISIBLE); } mMenuApply.setOnClickListener(this); mMenuSave.setOnClickListener(this); mMenuApply.setOnLongClickListener(this); mMenuSave.setOnLongClickListener(this); }
Example #3
Source File: CandyBarWallpaperActivity.java From candybar with Apache License 2.0 | 6 votes |
private void initBottomBar() { mName.setText(mWallpaper.getName()); mName.setTextColor(Color.WHITE); mAuthor.setText(mWallpaper.getAuthor()); mAuthor.setTextColor(ColorHelper.setColorAlpha(Color.WHITE, 0.7f)); mMenuSave.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_download, Color.WHITE)); mMenuApply.setImageDrawable(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_apply_options, Color.WHITE)); if (getResources().getBoolean(R.bool.enable_wallpaper_download)) { mMenuSave.setVisibility(View.VISIBLE); } mMenuApply.setOnClickListener(this); mMenuSave.setOnClickListener(this); mMenuApply.setOnLongClickListener(this); mMenuSave.setOnLongClickListener(this); }
Example #4
Source File: CandyBarSplashActivity.java From candybar-library with Apache License 2.0 | 6 votes |
private void initBottomText() { TextView splashTitle = findViewById(R.id.splash_title); if (splashTitle != null) { splashTitle.setText(mConfig.getBottomText()); if (mConfig.getBottomTextColor() != -1) { splashTitle.setTextColor(mConfig.getBottomTextColor()); } else { int color = ContextCompat.getColor(this, R.color.splashColor); splashTitle.setTextColor(ColorHelper.getBodyTextColor(color)); } splashTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, mConfig.getBottomTextSize()); splashTitle.setTypeface(mConfig.getBottomTextFont(this)); } }
Example #5
Source File: CreditsAdapter.java From candybar-library with Apache License 2.0 | 6 votes |
public CreditsAdapter(@NonNull Context context, @NonNull List<Credit> credits) { mContext = context; mCredits = credits; int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); Drawable drawable = DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_default_profile, color); mOptions = ImageConfig.getRawDefaultImageOptions(); mOptions.resetViewBeforeLoading(true); mOptions.cacheInMemory(true); mOptions.cacheOnDisk(true); mOptions.showImageForEmptyUri(drawable); mOptions.showImageOnFail(drawable); mOptions.showImageOnLoading(drawable); mOptions.displayer(new CircleBitmapDisplayer()); }
Example #6
Source File: RequestAdapter.java From candybar with Apache License 2.0 | 6 votes |
public RequestAdapter(@NonNull Context context, @NonNull List<Request> requests, int spanCount) { mContext = context; mRequests = requests; mTextColorSecondary = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); mTextColorAccent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent); mSelectedItems = new SparseBooleanArray(); mShowShadow = (spanCount == 1); mShowPremiumRequest = Preferences.get(mContext).isPremiumRequestEnabled(); mShowRegularRequest = Preferences.get(mContext).isRegularRequestLimit(); mOptions = ImageConfig.getRawDefaultImageOptions(); mOptions.resetViewBeforeLoading(true); mOptions.cacheInMemory(true); mOptions.cacheOnDisk(false); mOptions.showImageOnFail(R.drawable.ic_app_default); mOptions.displayer(new FadeInBitmapDisplayer(700)); }
Example #7
Source File: RequestAdapter.java From candybar-library with Apache License 2.0 | 6 votes |
public RequestAdapter(@NonNull Context context, @NonNull List<Request> requests, int spanCount) { mContext = context; mRequests = requests; mTextColorSecondary = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); mTextColorAccent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent); mSelectedItems = new SparseBooleanArray(); mShowShadow = (spanCount == 1); mShowPremiumRequest = Preferences.get(mContext).isPremiumRequestEnabled(); mOptions = ImageConfig.getRawDefaultImageOptions(); mOptions.resetViewBeforeLoading(true); mOptions.cacheInMemory(true); mOptions.cacheOnDisk(false); mOptions.showImageOnFail(R.drawable.ic_app_default); mOptions.displayer(new FadeInBitmapDisplayer(700)); }
Example #8
Source File: CreditsAdapter.java From candybar with Apache License 2.0 | 6 votes |
public CreditsAdapter(@NonNull Context context, @NonNull List<Credit> credits) { mContext = context; mCredits = credits; int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); Drawable drawable = DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_default_profile, color); mOptions = ImageConfig.getRawDefaultImageOptions(); mOptions.resetViewBeforeLoading(true); mOptions.cacheInMemory(true); mOptions.cacheOnDisk(true); mOptions.showImageForEmptyUri(drawable); mOptions.showImageOnFail(drawable); mOptions.showImageOnLoading(drawable); mOptions.displayer(new CircleBitmapDisplayer()); }
Example #9
Source File: ConfigurationHelper.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Nullable public static Drawable getNavigationIcon(@NonNull Context context, @WallpaperBoardConfiguration.NavigationIcon int navigationIcon) { int color = ColorHelper.getAttributeColor(context, R.attr.toolbar_icon); switch (navigationIcon) { case WallpaperBoardConfiguration.NavigationIcon.STYLE_1: return getTintedDrawable(context, R.drawable.ic_toolbar_navigation_1, color); case WallpaperBoardConfiguration.NavigationIcon.STYLE_2: return getTintedDrawable(context, R.drawable.ic_toolbar_navigation_2, color); case WallpaperBoardConfiguration.NavigationIcon.STYLE_3: return getTintedDrawable(context, R.drawable.ic_toolbar_navigation_3, color); case WallpaperBoardConfiguration.NavigationIcon.STYLE_4: return getTintedDrawable(context, R.drawable.ic_toolbar_navigation_4, color); case WallpaperBoardConfiguration.NavigationIcon.DEFAULT: default: return getTintedDrawable(context, R.drawable.ic_toolbar_navigation, color); } }
Example #10
Source File: WallpaperSearchFragment.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); resetViewBottomPadding(mRecyclerView, true); initSearchResult(); int color = ColorHelper.getAttributeColor(getActivity(), R.attr.toolbar_icon); mToolbar.setTitle(""); mToolbar.setNavigationIcon(DrawableHelper.getTintedDrawable( getActivity(), R.drawable.ic_toolbar_back, color)); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), getActivity().getResources().getInteger(R.integer.wallpapers_column_count))); mRecyclerView.setHasFixedSize(false); if (WallpaperBoardApplication.getConfig().getWallpapersGrid() == WallpaperBoardConfiguration.GridStyle.FLAT) { int padding = getActivity().getResources().getDimensionPixelSize(R.dimen.card_margin); mRecyclerView.setPadding(padding, padding, 0, 0); } }
Example #11
Source File: FilterFragment.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); if (getActivity() == null) return; if (getActivity().isFinishing()) return; mAsyncTask = null; if (aBoolean) { int color = ColorHelper.getAttributeColor(getActivity(), android.R.attr.textColorPrimary); mMenuSelect.setImageDrawable(DrawableHelper.getTintedDrawable(getActivity(), isAllSelected ? R.drawable.ic_toolbar_select_all_selected : R.drawable.ic_toolbar_select_all, color)); if (mAdapter != null) { mAdapter.setEnabled(true); mAdapter.notifyDataSetChanged(); } } }
Example #12
Source File: UrlHelper.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Nullable public static Drawable getSocialIcon(@NonNull Context context, @NonNull Type type) { int color = ColorHelper.getAttributeColor(context, android.R.attr.textColorPrimary); switch (type) { case EMAIL: return getTintedDrawable(context, R.drawable.ic_toolbar_email, color); case BEHANCE: return getTintedDrawable(context, R.drawable.ic_toolbar_behance, color); case DRIBBBLE: return getTintedDrawable(context, R.drawable.ic_toolbar_dribbble, color); case FACEBOOK: return getTintedDrawable(context, R.drawable.ic_toolbar_facebook, color); case GITHUB: return getTintedDrawable(context, R.drawable.ic_toolbar_github, color); case GOOGLE_PLUS: return getTintedDrawable(context, R.drawable.ic_toolbar_google_plus, color); case INSTAGRAM: return getTintedDrawable(context, R.drawable.ic_toolbar_instagram, color); case PINTEREST: return getTintedDrawable(context, R.drawable.ic_toolbar_pinterest, color); case TWITTER: return getTintedDrawable(context, R.drawable.ic_toolbar_twitter, color); default: return getTintedDrawable(context, R.drawable.ic_toolbar_website, color); } }
Example #13
Source File: WallpaperBoardSplashActivity.java From wallpaperboard with Apache License 2.0 | 6 votes |
private void initBottomText() { TextView splashTitle = findViewById(R.id.splash_title); if (splashTitle != null) { splashTitle.setText(mConfig.getBottomText()); if (mConfig.getBottomTextColor() != -1) { splashTitle.setTextColor(mConfig.getBottomTextColor()); } else { int color = ContextCompat.getColor(this, R.color.splashColor); splashTitle.setTextColor(ColorHelper.getBodyTextColor(color)); } splashTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, mConfig.getBottomTextSize()); splashTitle.setTypeface(mConfig.getBottomTextFont(this)); } }
Example #14
Source File: AboutAdapter.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == TYPE_HEADER) { HeaderViewHolder headerViewHolder = (HeaderViewHolder) holder; String imageUri = mContext.getString(R.string.about_image); if (ColorHelper.isValidColor(imageUri)) { headerViewHolder.image.setBackgroundColor(Color.parseColor(imageUri)); } else if (!URLUtil.isValidUrl(imageUri)) { imageUri = "drawable://" + DrawableHelper.getResourceId(mContext, imageUri); ImageLoader.getInstance().displayImage(imageUri, headerViewHolder.image, ImageConfig.getDefaultImageOptions()); } else { ImageLoader.getInstance().displayImage(imageUri, headerViewHolder.image, ImageConfig.getDefaultImageOptions()); } String profileUri = mContext.getResources().getString(R.string.about_profile_image); if (!URLUtil.isValidUrl(profileUri)) { profileUri = "drawable://" + DrawableHelper.getResourceId(mContext, profileUri); } ImageLoader.getInstance().displayImage(profileUri, headerViewHolder.profile, ImageConfig.getDefaultImageOptions()); } }
Example #15
Source File: Tooltip.java From wallpaperboard with Apache License 2.0 | 6 votes |
private Tooltip(Builder builder) { mBuilder = builder; mPopupWindow = new ListPopupWindow(mBuilder.mContext); mPopupWindow.setContentWidth(getMeasuredWidth(builder.mContext)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Drawable drawable = mPopupWindow.getBackground(); if (drawable != null) { drawable.setColorFilter(ColorHelper.getAttributeColor( builder.mContext, R.attr.card_background), PorterDuff.Mode.SRC_IN); } } else { mPopupWindow.setBackgroundDrawable(new ColorDrawable( ColorHelper.getAttributeColor(builder.mContext, R.attr.card_background))); } mPopupWindow.setListSelector(new ColorDrawable(Color.TRANSPARENT)); mPopupWindow.setAnchorView(mBuilder.mTo); mPopupWindow.setForceIgnoreOutsideTouch(true); mPopupWindow.setAdapter(new TooltipAdapter(mBuilder.mContext, this)); }
Example #16
Source File: AboutAdapter.java From wallpaperboard with Apache License 2.0 | 6 votes |
ContributorsViewHolder(View itemView) { super(itemView); TextView title = itemView.findViewById(R.id.title); CardView card = itemView.findViewById(R.id.card); if (!Preferences.get(mContext).isShadowEnabled() && card != null) { card.setCardElevation(0); } int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_people, color), null, null, null); title.setText(mContext.getResources().getString(R.string.about_contributors_title)); title.setOnClickListener(this); }
Example #17
Source File: AboutAdapter.java From wallpaperboard with Apache License 2.0 | 6 votes |
FooterViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); CardView card = itemView.findViewById(R.id.card); if (!Preferences.get(mContext).isShadowEnabled() && card != null) { card.setCardElevation(0); } int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); TextView title = itemView.findViewById(R.id.about_dashboard_title); title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_dashboard, color), null, null, null); instagram.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_instagram, color)); googlePlus.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_google_plus, color)); github.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_github, color)); instagram.setOnClickListener(this); googlePlus.setOnClickListener(this); github.setOnClickListener(this); licenses.setOnClickListener(this); contributors.setOnClickListener(this); translator.setOnClickListener(this); }
Example #18
Source File: CreditsAdapter.java From wallpaperboard with Apache License 2.0 | 6 votes |
public CreditsAdapter(@NonNull Context context, @NonNull List<Credit> credits) { mContext = context; mCredits = credits; int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); Drawable drawable = DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_default_profile, color); mOptions = ImageConfig.getRawDefaultImageOptions(); mOptions.resetViewBeforeLoading(true); mOptions.cacheInMemory(true); mOptions.cacheOnDisk(true); mOptions.showImageForEmptyUri(drawable); mOptions.showImageOnFail(drawable); mOptions.showImageOnLoading(drawable); mOptions.displayer(new CircleBitmapDisplayer()); }
Example #19
Source File: RefreshDurationFragment.java From wallpaperboard with Apache License 2.0 | 6 votes |
private void setDividerColor (NumberPicker picker) { java.lang.reflect.Field[] pickerFields = NumberPicker.class.getDeclaredFields(); for (java.lang.reflect.Field pf : pickerFields) { if (pf.getName().equals("mSelectionDivider")) { pf.setAccessible(true); try { int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorAccent); pf.set(picker, DrawableHelper.getTintedDrawable( getActivity(), R.drawable.numberpicker_divider, color)); } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); } break; } } }
Example #20
Source File: FavoritesFragment.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); if (getActivity() == null) return; if (getActivity().isFinishing()) return; mAsyncTask = null; if (aBoolean) { mRecyclerView.setAdapter(new WallpapersAdapter(getActivity(), wallpapers, true, false)); if (mRecyclerView.getAdapter().getItemCount() == 0) { int color = ColorHelper.getAttributeColor(getActivity(), android.R.attr.textColorSecondary); mFavoriteEmpty.setImageDrawable( DrawableHelper.getTintedDrawable(getActivity(), R.drawable.ic_wallpaper_favorite_empty, ColorHelper.setColorAlpha(color, 0.7f))); mFavoriteEmpty.setVisibility(View.VISIBLE); } } }
Example #21
Source File: WallpaperDetailsAdapter.java From wallpaperboard with Apache License 2.0 | 5 votes |
PaletteHeaderViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); TextView title = itemView.findViewById(R.id.title); int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); Drawable drawable = DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_details_palette, color); title.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); }
Example #22
Source File: ViewHelper.java From candybar-library with Apache License 2.0 | 5 votes |
public static void setFastScrollColor(@Nullable RecyclerFastScroller fastScroll) { if (fastScroll == null) return; Context context = fastScroll.getContext(); if (context instanceof ContextThemeWrapper) { context = ((ContextThemeWrapper) context).getBaseContext(); } int accent = ColorHelper.getAttributeColor(context, R.attr.colorAccent); fastScroll.setBarColor(ColorHelper.setColorAlpha(accent, 0.8f)); fastScroll.setHandleNormalColor(accent); fastScroll.setHandlePressedColor(ColorHelper.getDarkerColor(accent, 0.7f)); }
Example #23
Source File: CandyBarMainActivity.java From candybar-library with Apache License 2.0 | 5 votes |
@Override public void onSearchExpanded(boolean expand) { Toolbar toolbar = findViewById(R.id.toolbar); mIsMenuVisible = !expand; if (expand) { int color = ColorHelper.getAttributeColor(this, R.attr.toolbar_icon); toolbar.setNavigationIcon(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_back, color)); toolbar.setNavigationOnClickListener(view -> onBackPressed()); } else { SoftKeyboardHelper.closeKeyboard(this); ColorHelper.setStatusBarColor(this, Color.TRANSPARENT, true); if (CandyBarApplication.getConfiguration().getNavigationIcon() == CandyBarApplication.NavigationIcon.DEFAULT) { mDrawerToggle.setDrawerArrowDrawable(new DrawerArrowDrawable(this)); } else { toolbar.setNavigationIcon(ConfigurationHelper.getNavigationIcon(this, CandyBarApplication.getConfiguration().getNavigationIcon())); } toolbar.setNavigationOnClickListener(view -> mDrawerLayout.openDrawer(GravityCompat.START)); } mDrawerLayout.setDrawerLockMode(expand ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED : DrawerLayout.LOCK_MODE_UNLOCKED); supportInvalidateOptionsMenu(); }
Example #24
Source File: ChangelogAdapter.java From candybar-library with Apache License 2.0 | 5 votes |
ViewHolder(View view) { changelog = view.findViewById(R.id.changelog); int color = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent); changelog.setCompoundDrawablesWithIntrinsicBounds( DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_changelog_dot, color), null, null, null); }
Example #25
Source File: AboutAdapter.java From candybar-library with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == TYPE_HEADER) { HeaderViewHolder headerViewHolder = (HeaderViewHolder) holder; String imageUri = mContext.getString(R.string.about_image); if (ColorHelper.isValidColor(imageUri)) { headerViewHolder.image.setBackgroundColor(Color.parseColor(imageUri)); } else if (!URLUtil.isValidUrl(imageUri)) { imageUri = "drawable://" + DrawableHelper.getResourceId(mContext, imageUri); ImageLoader.getInstance().displayImage(imageUri, headerViewHolder.image, ImageConfig.getDefaultImageOptions(true)); } else { ImageLoader.getInstance().displayImage(imageUri, headerViewHolder.image, ImageConfig.getDefaultImageOptions(true)); } String profileUri = mContext.getResources().getString(R.string.about_profile_image); if (!URLUtil.isValidUrl(profileUri)) { profileUri = "drawable://" + DrawableHelper.getResourceId(mContext, profileUri); } ImageLoader.getInstance().displayImage(profileUri, headerViewHolder.profile, ImageConfig.getDefaultImageOptions(true)); } }
Example #26
Source File: WallpaperBoardMuzeiActivity.java From wallpaperboard with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.setTheme(Preferences.get(this).isDarkTheme() ? R.style.MuzeiThemeDark : R.style.MuzeiTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_muzei); ButterKnife.bind(this); mMuzeiService = onInit(); ViewCompat.setNestedScrollingEnabled(mScrollView, false); WindowHelper.disableTranslucentNavigationBar(this); ColorHelper.setNavigationBarColor(this, ColorHelper.getDarkerColor( ColorHelper.getAttributeColor(this, R.attr.colorAccent), 0.8f)); ColorHelper.setStatusBarColor(this, ColorHelper.getAttributeColor( this, R.attr.colorPrimaryDark)); ColorHelper.setupStatusBarIconColor(this); int color = ColorHelper.getAttributeColor(this, R.attr.toolbar_icon); Toolbar toolbar = findViewById(R.id.toolbar); toolbar.setTitle(""); toolbar.setNavigationIcon(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_muzei, color)); setSupportActionBar(toolbar); mIsMinute = Preferences.get(this).isRotateMinute(); mRotateTime = TimeHelper.milliToMinute( Preferences.get(this).getRotateTime()); if (!mIsMinute) mRotateTime = mRotateTime / 60; initRefreshDuration(); initSettings(); mWifiOnly.setOnClickListener(this); mSelectCategories.setOnClickListener(this); mRefreshDuration.setOnClickListener(this); mSave.setOnClickListener(this); mWifiOnlyCheck.setChecked(Preferences.get(this).isWifiOnly()); }
Example #27
Source File: ConfigurationHelper.java From candybar with Apache License 2.0 | 5 votes |
public static int getSocialIconColor(@NonNull Context context, @NonNull CandyBarApplication.IconColor iconColor) { switch (iconColor) { case ACCENT: return ColorHelper.getAttributeColor(context, R.attr.colorAccent); case PRIMARY_TEXT: return ColorHelper.getAttributeColor(context, android.R.attr.textColorPrimary); default: return ColorHelper.getAttributeColor(context, android.R.attr.textColorPrimary); } }
Example #28
Source File: HomeAdapter.java From candybar-library with Apache License 2.0 | 5 votes |
WallpapersViewHolder(View itemView) { super(itemView); title = itemView.findViewById(R.id.title); TextView muzei = itemView.findViewById(R.id.muzei); CardView card = itemView.findViewById(R.id.card); if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) { if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) { card.setRadius(0f); card.setUseCompatPadding(false); int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin); StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams(); params.setMargins(0, 0, margin, margin); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { params.setMarginEnd(margin); } } } if (!Preferences.get(mContext).isCardShadowEnabled()) { card.setCardElevation(0); } int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_wallpapers, color), null, null, null); muzei.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.get( mContext, R.drawable.ic_home_app_muzei), null, null, null); title.setOnClickListener(this); muzei.setOnClickListener(this); }
Example #29
Source File: AboutAdapter.java From candybar-library with Apache License 2.0 | 5 votes |
ContributorsViewHolder(View itemView) { super(itemView); TextView title = itemView.findViewById(R.id.title); CardView card = itemView.findViewById(R.id.card); if (CandyBarApplication.getConfiguration().getAboutStyle() == CandyBarApplication.Style.PORTRAIT_FLAT_LANDSCAPE_FLAT && card != null) { if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) { card.setRadius(0f); card.setUseCompatPadding(false); int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin); StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams(); params.setMargins(0, 0, margin, margin); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { params.setMarginEnd(margin); } } } if (!Preferences.get(mContext).isCardShadowEnabled()) { if (card != null) card.setCardElevation(0); } int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_people, color), null, null, null); title.setText(mContext.getResources().getString(R.string.about_contributors_title)); title.setOnClickListener(this); }
Example #30
Source File: WallpaperBoardMuzeiActivity.java From wallpaperboard with Apache License 2.0 | 5 votes |
private void initSettings() { int color = ColorHelper.getAttributeColor(this, R.attr.colorAccent); int titleColor = ColorHelper.getTitleTextColor(color); ImageView icon = findViewById(R.id.muzei_save_icon); icon.setImageDrawable(DrawableHelper.getTintedDrawable(this, R.drawable.ic_toolbar_save, titleColor)); TextView text = findViewById(R.id.muzei_save_text); text.setTextColor(titleColor); }