mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-14 18:57:30 +00:00
Null check. Fixes austinhuang0131/barinsta#1598
This commit is contained in:
parent
a9b9f8e2a8
commit
b8ad359997
@ -130,9 +130,7 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
|
|||||||
}
|
}
|
||||||
// binding.title.setTransitionName("title-" + topicCluster.getCollectionId());
|
// binding.title.setTransitionName("title-" + topicCluster.getCollectionId());
|
||||||
binding.cover.setTransitionName("cover-" + topicCluster.getCollectionId());
|
binding.cover.setTransitionName("cover-" + topicCluster.getCollectionId());
|
||||||
final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMediaList() == null
|
final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMediaList().get(0));
|
||||||
? topicCluster.getCoverMedia()
|
|
||||||
: topicCluster.getCoverMediaList().get(0));
|
|
||||||
if (thumbUrl == null) {
|
if (thumbUrl == null) {
|
||||||
binding.cover.setImageURI((String) null);
|
binding.cover.setImageURI((String) null);
|
||||||
} else {
|
} else {
|
||||||
@ -150,17 +148,20 @@ 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(
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
new int[]{Color.TRANSPARENT, backgroundColor.get()});
|
new int[]{Color.TRANSPARENT, backgroundColor.get()}
|
||||||
|
);
|
||||||
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