mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Null check palette object. Should fix https://github.com/austinhuang0131/barinsta/issues/567
This commit is contained in:
parent
23830f5a9d
commit
ae79a35d01
@ -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);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user