Fix loading views inconsistently showing cover

This commit is contained in:
ByteHamster 2022-09-15 20:26:24 +02:00
parent ad9de4467b
commit 5baa13b53d
2 changed files with 11 additions and 6 deletions

View File

@ -70,7 +70,10 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
@Override @Override
public final void onBindViewHolder(EpisodeItemViewHolder holder, int pos) { public final void onBindViewHolder(EpisodeItemViewHolder holder, int pos) {
if (pos >= episodes.size()) { if (pos >= episodes.size()) {
beforeBindViewHolder(holder, pos);
holder.bindDummy(); holder.bindDummy();
afterBindViewHolder(holder, pos);
holder.hideSeparatorIfNecessary();
return; return;
} }

View File

@ -199,6 +199,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder {
} }
public void bindDummy() { public void bindDummy() {
item = new FeedItem();
container.setAlpha(0.1f); container.setAlpha(0.1f);
secondaryActionIcon.setImageDrawable(null); secondaryActionIcon.setImageDrawable(null);
isInbox.setVisibility(View.VISIBLE); isInbox.setVisibility(View.VISIBLE);
@ -215,12 +216,13 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder {
size.setText(""); size.setText("");
itemView.setBackgroundResource(ThemeUtils.getDrawableFromAttr(activity, R.attr.selectableItemBackground)); itemView.setBackgroundResource(ThemeUtils.getDrawableFromAttr(activity, R.attr.selectableItemBackground));
placeholder.setText(""); placeholder.setText("");
new CoverLoader(activity) if (coverHolder.getVisibility() == View.VISIBLE) {
.withResource(ThemeUtils.getDrawableFromAttr(activity, android.R.attr.textColorSecondary)) new CoverLoader(activity)
.withPlaceholderView(placeholder) .withResource(ThemeUtils.getDrawableFromAttr(activity, android.R.attr.textColorSecondary))
.withCoverView(cover) .withPlaceholderView(placeholder)
.load(); .withCoverView(cover)
hideSeparatorIfNecessary(); .load();
}
} }
private void updateDuration(PlaybackPositionEvent event) { private void updateDuration(PlaybackPositionEvent event) {