mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-16 19:57:31 +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,16 +81,18 @@ 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 (swatch != null) {
|
if (p != null) {
|
||||||
backgroundColor.set(swatch.getRgb());
|
final Palette.Swatch swatch = p.getDominantSwatch();
|
||||||
GradientDrawable gd = new GradientDrawable(
|
if (swatch != null) {
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
backgroundColor.set(swatch.getRgb());
|
||||||
new int[]{Color.TRANSPARENT, backgroundColor.get()});
|
GradientDrawable gd = new GradientDrawable(
|
||||||
titleTextColor = swatch.getTitleTextColor();
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
binding.background.setBackground(gd);
|
new int[]{Color.TRANSPARENT, backgroundColor.get()});
|
||||||
|
titleTextColor = swatch.getTitleTextColor();
|
||||||
|
binding.background.setBackground(gd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
titleColor.set(titleTextColor);
|
titleColor.set(titleTextColor);
|
||||||
binding.title.setTextColor(titleTextColor);
|
binding.title.setTextColor(titleTextColor);
|
||||||
@ -127,8 +129,8 @@ public class TopicClusterViewHolder extends RecyclerView.ViewHolder {
|
|||||||
// binding.title.setTransitionName("title-" + topicCluster.getId());
|
// binding.title.setTransitionName("title-" + topicCluster.getId());
|
||||||
binding.cover.setTransitionName("cover-" + topicCluster.getId());
|
binding.cover.setTransitionName("cover-" + topicCluster.getId());
|
||||||
final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMedias() == null
|
final String thumbUrl = ResponseBodyUtils.getThumbUrl(topicCluster.getCoverMedias() == null
|
||||||
? topicCluster.getCoverMedia()
|
? topicCluster.getCoverMedia()
|
||||||
: topicCluster.getCoverMedias().get(0));
|
: topicCluster.getCoverMedias().get(0));
|
||||||
if (thumbUrl == null) {
|
if (thumbUrl == null) {
|
||||||
binding.cover.setImageURI((String) null);
|
binding.cover.setImageURI((String) null);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user