Java Code Examples for com.danimahardhika.android.helpers.core.ColorHelper#getAttributeColor()
The following examples show how to use
com.danimahardhika.android.helpers.core.ColorHelper#getAttributeColor() .
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: 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 2
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 3
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 4
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 5
Source File: CreditsAdapter.java From candybar with Apache License 2.0 | 5 votes |
ViewHolder(View view) { container = view.findViewById(R.id.container); title = view.findViewById(R.id.title); subtitle = view.findViewById(R.id.subtitle); image = view.findViewById(R.id.image); int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorSecondary); ViewCompat.setBackground(image, DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_circle, ColorHelper.setColorAlpha(color, 0.4f))); }
Example 6
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 7
Source File: WallpaperBoardBrowserActivity.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.BrowserThemeDark : R.style.BrowserTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_wallpaper_browser); ButterKnife.bind(this); int color = ColorHelper.getAttributeColor(this, R.attr.colorPrimary); ColorHelper.setupStatusBarIconColor(this, ColorHelper.isLightColor(color)); WindowHelper.resetNavigationBarTranslucent(this, WindowHelper.NavigationBarTranslucent.PORTRAIT_ONLY); SoftKeyboardHelper softKeyboardHelper = new SoftKeyboardHelper(this, findViewById(R.id.container)); softKeyboardHelper.enable(); mFragManager = getSupportFragmentManager(); if (savedInstanceState != null) { mFragmentId = savedInstanceState.getInt(Extras.EXTRA_FRAGMENT_ID); mCategoryName = savedInstanceState.getString(Extras.EXTRA_CATEGORY); mCategoryCount = savedInstanceState.getInt(Extras.EXTRA_COUNT); } Bundle bundle = getIntent().getExtras(); if (bundle != null) { mFragmentId = bundle.getInt(Extras.EXTRA_FRAGMENT_ID); mCategoryName = bundle.getString(Extras.EXTRA_CATEGORY); mCategoryCount = bundle.getInt(Extras.EXTRA_COUNT); } setFragment(); }
Example 8
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 9
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 10
Source File: FilterFragment.java From wallpaperboard with Apache License 2.0 | 5 votes |
private void initMenuSelect() { int color = ColorHelper.getAttributeColor(getActivity(), android.R.attr.textColorPrimary); boolean isAllSelected = mAdapter.getCount() == mAdapter.getSelectedCount(); mMenuSelect.setImageDrawable(DrawableHelper.getTintedDrawable(getActivity(), isAllSelected ? R.drawable.ic_toolbar_select_all_selected : R.drawable.ic_toolbar_select_all, color)); AnimationHelper.show(mMenuSelect).start(); }
Example 11
Source File: HomeAdapter.java From candybar-library with Apache License 2.0 | 5 votes |
IconRequestViewHolder(View itemView) { super(itemView); title = itemView.findViewById(R.id.title); installedApps = itemView.findViewById(R.id.installed_apps); missedApps = itemView.findViewById(R.id.missed_apps); themedApps = itemView.findViewById(R.id.themed_apps); progress = itemView.findViewById(R.id.progress); container = itemView.findViewById(R.id.container); 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_icon_request, color), null, null, null); int accent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent); progress.getProgressDrawable().setColorFilter(accent, PorterDuff.Mode.SRC_IN); container.setOnClickListener(this); }
Example 12
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 13
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 14
Source File: WallpapersFragment.java From candybar-library with Apache License 2.0 | 5 votes |
private void initPopupBubble() { int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorAccent); mPopupBubble.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( getActivity(), R.drawable.ic_toolbar_arrow_up, ColorHelper.getTitleTextColor(color)), null, null, null); mPopupBubble.setOnClickListener(view -> { WallpapersListener listener = (WallpapersListener) getActivity(); listener.onWallpapersChecked(null); AnimationHelper.hide(getActivity().findViewById(R.id.popup_bubble)) .start(); mAsyncTask = new WallpapersLoader(true).execute(); }); }
Example 15
Source File: Popup.java From candybar with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View view, ViewGroup viewGroup) { ViewHolder holder; if (view == null) { view = View.inflate(mContext, R.layout.popup_item_list, null); holder = new ViewHolder(view); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } PopupItem item = mItems.get(position); holder.checkBox.setVisibility(View.GONE); if (item.isShowCheckbox()) { holder.checkBox.setChecked(item.getCheckboxValue()); holder.checkBox.setVisibility(View.VISIBLE); } int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); if (item.isSelected()) { color = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent); } if (item.getIcon() != 0) { Drawable drawable = DrawableHelper.getTintedDrawable(mContext, item.getIcon(), color); holder.title.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); } holder.title.setText(item.getTitle()); holder.title.setTextColor(color); return view; }
Example 16
Source File: WallpaperApplyTask.java From candybar with Apache License 2.0 | 5 votes |
public AsyncTask start(@NonNull Executor executor) { if (mDialog == null) { int color = mWallpaper.getColor(); if (color == 0) { color = ColorHelper.getAttributeColor(mContext.get(), R.attr.colorAccent); } final MaterialDialog.Builder builder = new MaterialDialog.Builder(mContext.get()); builder.widgetColor(color) .typeface(TypefaceHelper.getMedium(mContext.get()), TypefaceHelper.getRegular(mContext.get())) .progress(true, 0) .cancelable(false) .progressIndeterminateStyle(true) .content(R.string.wallpaper_loading) .positiveColor(color) .positiveText(android.R.string.cancel) .onPositive((dialog, which) -> { ImageLoader.getInstance().stop(); cancel(true); }); mDialog = builder.build(); } if (!mDialog.isShowing()) mDialog.show(); mExecutor = executor; if (mWallpaper == null) { LogUtil.e("WallpaperApply cancelled, wallpaper is null"); return null; } if (mWallpaper.getDimensions() == null) { return WallpaperPropertiesLoaderTask.prepare(mContext.get()) .wallpaper(mWallpaper) .callback(this) .start(AsyncTask.THREAD_POOL_EXECUTOR); } return executeOnExecutor(executor); }
Example 17
Source File: WallpapersFragment.java From candybar with Apache License 2.0 | 5 votes |
private void initPopupBubble() { int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorAccent); mPopupBubble.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable( getActivity(), R.drawable.ic_toolbar_arrow_up, ColorHelper.getTitleTextColor(color)), null, null, null); mPopupBubble.setOnClickListener(view -> { WallpapersListener listener = (WallpapersListener) getActivity(); listener.onWallpapersChecked(null); AnimationHelper.hide(getActivity().findViewById(R.id.popup_bubble)) .start(); mAsyncTask = new WallpapersLoader(true).execute(); }); }
Example 18
Source File: FilterAdapter.java From wallpaperboard with Apache License 2.0 | 5 votes |
ViewHolder(@NonNull View view) { ButterKnife.bind(this, view); int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); ViewCompat.setBackground(counter, DrawableHelper.getTintedDrawable( mContext, R.drawable.ic_toolbar_circle, color)); counter.setTextColor(ColorHelper.getTitleTextColor(color)); }
Example 19
Source File: AboutAdapter.java From candybar-library with Apache License 2.0 | 4 votes |
FooterViewHolder(View itemView) { super(itemView); ImageView instagram = itemView.findViewById(R.id.about_dev_instagram); ImageView googlePlus = itemView.findViewById(R.id.about_dev_google_plus); ImageView github = itemView.findViewById(R.id.about_dev_github); TextView title = itemView.findViewById(R.id.about_dashboard_title); TextView licenses = itemView.findViewById(R.id.about_dashboard_licenses); TextView contributors = itemView.findViewById(R.id.about_dashboard_contributors); TextView translator = itemView.findViewById(R.id.about_dashboard_translator); 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_dashboard, color), null, null, null); color = ConfigurationHelper.getSocialIconColor(mContext, CandyBarApplication.getConfiguration().getSocialIconColor()); 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 20
Source File: SettingsAdapter.java From candybar with Apache License 2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == TYPE_CONTENT) { ContentViewHolder contentViewHolder = (ContentViewHolder) holder; Setting setting = mSettings.get(position); if (setting.getTitle().length() == 0) { contentViewHolder.title.setVisibility(View.GONE); contentViewHolder.divider.setVisibility(View.GONE); contentViewHolder.container.setVisibility(View.VISIBLE); contentViewHolder.subtitle.setText(setting.getSubtitle()); if (setting.getContent().length() == 0) { contentViewHolder.content.setVisibility(View.GONE); } else { contentViewHolder.content.setText(setting.getContent()); contentViewHolder.content.setVisibility(View.VISIBLE); } if (setting.getFooter().length() == 0) { contentViewHolder.footer.setVisibility(View.GONE); } else { contentViewHolder.footer.setText(setting.getFooter()); contentViewHolder.footer.setVisibility(View.VISIBLE); } if (setting.getCheckState() >= 0) { contentViewHolder.checkBox.setVisibility(View.VISIBLE); contentViewHolder.checkBox.setChecked(setting.getCheckState() == 1); } else { contentViewHolder.checkBox.setVisibility(View.GONE); } } else { contentViewHolder.container.setVisibility(View.GONE); contentViewHolder.title.setVisibility(View.VISIBLE); contentViewHolder.title.setText(setting.getTitle()); if (position > 0) { contentViewHolder.divider.setVisibility(View.VISIBLE); } else { contentViewHolder.divider.setVisibility(View.GONE); } if (setting.getIcon() != -1) { int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary); contentViewHolder.title.setCompoundDrawablesWithIntrinsicBounds( DrawableHelper.getTintedDrawable(mContext, setting.getIcon(), color), null, null, null); } } } }