Java Code Examples for com.kabouzeid.appthemehelper.util.ATHUtil#resolveColor()
The following examples show how to use
com.kabouzeid.appthemehelper.util.ATHUtil#resolveColor() .
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: SongFileAdapter.java From Music-Player with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("ConstantConditions") protected void loadFileImage(File file, final ViewHolder holder) { final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor); if (file.isDirectory()) { holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); holder.image.setImageResource(R.drawable.ic_folder_white_24dp); } else { Drawable error = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); Glide.with(activity) .load(new AudioFileCover(file.getPath())) .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .animate(android.R.anim.fade_in) .signature(new MediaStoreSignature("", file.lastModified(), 0)) .into(holder.image); } }
Example 2
Source File: SongFileAdapter.java From Orin with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("ConstantConditions") protected void loadFileImage(File file, final ViewHolder holder) { final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor); if (file.isDirectory()) { holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); holder.image.setImageResource(R.drawable.ic_folder_white_24dp); } else { Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); Glide.with(activity) .load(new AudioFileCover(file.getPath())) .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .animate(android.R.anim.fade_in) .signature(new MediaStoreSignature("", file.lastModified(), 0)) .into(holder.image); } }
Example 3
Source File: SongFileAdapter.java From VinylMusicPlayer with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("ConstantConditions") protected void loadFileImage(File file, final ViewHolder holder) { final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor); if (file.isDirectory()) { holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); holder.image.setImageResource(R.drawable.ic_folder_white_24dp); } else { Drawable error = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); GlideApp.with(activity) .load(new AudioFileCover(file.getPath())) .transition(GenericTransitionOptions.with(android.R.anim.fade_in)) .apply(new RequestOptions() .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .signature(new MediaStoreSignature("", file.lastModified(), 0))) .into(holder.image); } }
Example 4
Source File: FlatPlaybackControlsFragment.java From RetroMusicPlayer with GNU General Public License v3.0 | 6 votes |
public void setDark(int dark) { int color = ATHUtil.resolveColor(getActivity(), android.R.attr.colorBackground); if (ColorUtil.isColorLight(color)) { lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true); lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true); } else { lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false); lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false); } if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) { updateTextColors(dark); setProgressBarColor(dark); TintHelper.setTintAuto(mPlayerPlayPauseFab, dark, true); } else { int accentColor = ThemeStore.accentColor(getContext()); updateTextColors(accentColor); setProgressBarColor(accentColor); } updateRepeatState(); updateShuffleState(); updatePrevNextColor(); updateProgressTextColor(); }
Example 5
Source File: PlayerPlaybackControlsFragment.java From RetroMusicPlayer with GNU General Public License v3.0 | 6 votes |
@Override public void setDark(int dark) { int color = ATHUtil.resolveColor(getActivity(), android.R.attr.colorBackground); if (ColorUtil.isColorLight(color)) { lastPlaybackControlsColor = MaterialValueHelper .getSecondaryTextColor(getActivity(), true); lastDisabledPlaybackControlsColor = MaterialValueHelper .getSecondaryDisabledTextColor(getActivity(), true); } else { lastPlaybackControlsColor = MaterialValueHelper .getPrimaryTextColor(getActivity(), false); lastDisabledPlaybackControlsColor = MaterialValueHelper .getPrimaryDisabledTextColor(getActivity(), false); } if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) { TintHelper.setTintAuto(playPauseFab, dark, true); setProgressBarColor(progressSlider, dark); text.setTextColor(dark); } else { text.setTextColor(ThemeStore.accentColor(getContext())); } updateRepeatState(); updateShuffleState(); updatePrevNextColor(); }
Example 6
Source File: SongFileAdapter.java From RetroMusicPlayer with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("ConstantConditions") protected void loadFileImage(File file, final ViewHolder holder) { final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor); if (file.isDirectory()) { holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); holder.image.setImageResource(R.drawable.ic_folder_white_24dp); } else { Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); Glide.with(activity) .load(new AudioFileCover(file.getPath())) .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .animate(android.R.anim.fade_in) .signature(new MediaStoreSignature("", file.lastModified(), 0)) .into(holder.image); } }
Example 7
Source File: SongFileAdapter.java From Phonograph with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("ConstantConditions") protected void loadFileImage(File file, final ViewHolder holder) { final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor); if (file.isDirectory()) { holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); holder.image.setImageResource(R.drawable.ic_folder_white_24dp); } else { Drawable error = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); Glide.with(activity) .load(new AudioFileCover(file.getPath())) .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .animate(android.R.anim.fade_in) .signature(new MediaStoreSignature("", file.lastModified(), 0)) .into(holder.image); } }
Example 8
Source File: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 5 votes |
@Override @NonNull public View getView(final int position, View convertView, @NonNull ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(LAYOUT_RES_ID, parent, false); } SkuDetails skuDetails = getItem(position); ViewHolder viewHolder = new ViewHolder(convertView); viewHolder.title.setText(skuDetails.title.replace("(Phonograph Music Player)", "").trim()); viewHolder.text.setText(skuDetails.description); viewHolder.price.setText(skuDetails.priceText); final boolean purchased = donationsDialog.billingProcessor.isPurchased(skuDetails.productId); int titleTextColor = purchased ? ATHUtil.resolveColor(getContext(), android.R.attr.textColorHint) : ThemeStore.textColorPrimary(getContext()); int contentTextColor = purchased ? titleTextColor : ThemeStore.textColorSecondary(getContext()); //noinspection ResourceAsColor viewHolder.title.setTextColor(titleTextColor); //noinspection ResourceAsColor viewHolder.text.setTextColor(contentTextColor); //noinspection ResourceAsColor viewHolder.price.setTextColor(titleTextColor); strikeThrough(viewHolder.title, purchased); strikeThrough(viewHolder.text, purchased); strikeThrough(viewHolder.price, purchased); convertView.setOnTouchListener((v, event) -> purchased); convertView.setOnClickListener(v -> donationsDialog.donate(position)); return convertView; }
Example 9
Source File: PlayingQueueAdapter.java From VinylMusicPlayer with GNU General Public License v3.0 | 5 votes |
public static int getBackgroundColor(AppCompatActivity activity){ //TODO: Find a better way to get the album background color TextView tV = activity.findViewById(R.id.player_queue_sub_header); if(tV != null){ return tV.getCurrentTextColor(); } else { return ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor); } }
Example 10
Source File: BottomNavigationViewHelper.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
public static void disableShiftMode(Context context, BottomNavigationView view) { int color = ATHUtil.resolveColor(context, android.R.attr.textColorSecondary); setItemIconColors(view, color, ThemeStore.accentColor(context)); setItemTextColors(view, color, ThemeStore.accentColor(context)); BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0); try { Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode"); shiftingMode.setAccessible(true); shiftingMode.setBoolean(menuView, false); shiftingMode.setAccessible(false); for (int i = 0; i < menuView.getChildCount(); i++) { BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i); /*TextView smallText = (TextView) item.findViewById(R.id.smallLabel); smallText.setVisibility(View.GONE); TextView largeLabel = (TextView) item.findViewById(R.id.largeLabel); largeLabel.setVisibility(View.GONE); AppCompatImageView icon = (AppCompatImageView) item.getChildAt(0); FrameLayout.LayoutParams params = (BottomNavigationView.LayoutParams) icon.getLayoutParams(); params.gravity = Gravity.CENTER;*/ //noinspection RestrictedApi item.setShiftingMode(false); // set once again checked value, so view will be updated //noinspection RestrictedApi item.setChecked(item.getItemData().isChecked()); } } catch (NoSuchFieldException | IllegalAccessException ignored) { ignored.printStackTrace(); } }
Example 11
Source File: FlatPlayerFragment.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
private void setUpPlayerToolbar() { mToolbar.inflateMenu(R.menu.menu_player); mToolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); mToolbar.setOnMenuItemClickListener(this); iconColor = PreferenceUtil.getInstance(getContext()).getAdaptiveColor() ? Color.WHITE : ATHUtil.resolveColor(getContext(), R.attr.iconColor); }
Example 12
Source File: PhonographColoredTarget.java From Phonograph with GNU General Public License v3.0 | 4 votes |
protected int getAlbumArtistFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor); }
Example 13
Source File: MusicColoredTarget.java From Music-Player with GNU General Public License v3.0 | 4 votes |
protected int getDefaultFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor); }
Example 14
Source File: PlayingSongDecorationUtil.java From VinylMusicPlayer with GNU General Public License v3.0 | 4 votes |
public static void decorate( @Nullable final TextView title, @Nullable final ImageView image, @Nullable final TextView imageText, Song song, @NonNull final AppCompatActivity activity, boolean showAlbumImage) { final boolean isPlaying = MusicPlayerRemote.isPlaying(song); if (title != null) { title.setTypeface(null, isPlaying ? Typeface.BOLD : Typeface.NORMAL); } if (image != null) { image.setVisibility((isPlaying || showAlbumImage) ? View.VISIBLE : View.GONE); final boolean animateIcon = PreferenceUtil.getInstance().animatePlayingSongIcon(); if (isPlaying) { image.setScaleType(ImageView.ScaleType.CENTER); final int color = ATHUtil.resolveColor(activity, R.attr.iconColor, ThemeStore.textColorSecondary(activity)); image.setColorFilter(color, PorterDuff.Mode.SRC_IN); final int size = (int)(24 * activity.getResources().getDisplayMetrics().density); // Note: No transition for Glide, the animation is explicitly controlled GlideApp.with(activity) .asBitmap() .load(sIconPlaying) .override(size) .into(image); if (animateIcon) { image.startAnimation(sIconAnimation); } } else { image.clearColorFilter(); if (animateIcon) { image.clearAnimation(); } } } if (imageText != null) { imageText.setVisibility((isPlaying || showAlbumImage) ? View.GONE : View.VISIBLE); } }
Example 15
Source File: VinylColoredTarget.java From VinylMusicPlayer with GNU General Public License v3.0 | 4 votes |
protected int getDefaultFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor); }
Example 16
Source File: RetroMusicColoredTarget.java From RetroMusicPlayer with GNU General Public License v3.0 | 4 votes |
protected int getAlbumArtistFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor); }
Example 17
Source File: RetroMusicColoredTarget.java From RetroMusicPlayer with GNU General Public License v3.0 | 4 votes |
protected int getDefaultFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor); }
Example 18
Source File: PhonographColoredTarget.java From Orin with GNU General Public License v3.0 | 4 votes |
protected int getAlbumArtistFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor); }
Example 19
Source File: PhonographColoredTarget.java From Orin with GNU General Public License v3.0 | 4 votes |
protected int getDefaultFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor); }
Example 20
Source File: MusicColoredTarget.java From Music-Player with GNU General Public License v3.0 | 4 votes |
protected int getAlbumArtistFooterColor() { return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor); }