1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00
This commit is contained in:
Ammar Githam 2021-03-17 00:54:43 +09:00
parent 23830f5a9d
commit ae79a35d01

View File

@ -81,9 +81,10 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
} }
if (bitmap != null) { if (bitmap != null) {
Palette.from(bitmap).generate(p -> { Palette.from(bitmap).generate(p -> {
final Palette.Swatch swatch = p.getDominantSwatch();
final Resources resources = itemView.getResources(); final Resources resources = itemView.getResources();
int titleTextColor = resources.getColor(R.color.white); int titleTextColor = resources.getColor(R.color.white);
if (p != null) {
final Palette.Swatch swatch = p.getDominantSwatch();
if (swatch != null) { if (swatch != null) {
backgroundColor.set(swatch.getRgb()); backgroundColor.set(swatch.getRgb());
GradientDrawable gd = new GradientDrawable( GradientDrawable gd = new GradientDrawable(
@ -92,6 +93,7 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
titleTextColor = swatch.getTitleTextColor(); titleTextColor = swatch.getTitleTextColor();
binding.background.setBackground(gd); binding.background.setBackground(gd);
} }
}
titleColor.set(titleTextColor); titleColor.set(titleTextColor);
binding.title.setTextColor(titleTextColor); binding.title.setTextColor(titleTextColor);
}); });