Improve layout for missing chapter images (#7164)
If only some chapters have images the other chapters don't display anything but reserve space for the image. Now those chapters display the image of the episode. If no chapters have images no images will be displayed (just like before).
This commit is contained in:
parent
6f572faa77
commit
2827f41430
|
@ -19,6 +19,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.model.feed.Chapter;
|
import de.danoeh.antennapod.model.feed.Chapter;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
import de.danoeh.antennapod.ui.common.Converter;
|
||||||
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
|
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
|
||||||
|
import de.danoeh.antennapod.ui.common.ImagePlaceholder;
|
||||||
import de.danoeh.antennapod.ui.common.IntentUtils;
|
import de.danoeh.antennapod.ui.common.IntentUtils;
|
||||||
import de.danoeh.antennapod.model.playback.Playable;
|
import de.danoeh.antennapod.model.playback.Playable;
|
||||||
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
||||||
|
@ -99,15 +100,27 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
|
||||||
|
|
||||||
if (hasImages) {
|
if (hasImages) {
|
||||||
holder.image.setVisibility(View.VISIBLE);
|
holder.image.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
float radius = 4 * context.getResources().getDisplayMetrics().density;
|
||||||
|
RequestOptions options = new RequestOptions()
|
||||||
|
.placeholder(ImagePlaceholder.getDrawable(context, radius))
|
||||||
|
.dontAnimate()
|
||||||
|
.transform(new FitCenter(), new RoundedCorners((int) radius));
|
||||||
|
|
||||||
if (TextUtils.isEmpty(sc.getImageUrl())) {
|
if (TextUtils.isEmpty(sc.getImageUrl())) {
|
||||||
|
if (media.getImageLocation() == null) {
|
||||||
Glide.with(context).clear(holder.image);
|
Glide.with(context).clear(holder.image);
|
||||||
|
holder.image.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
Glide.with(context)
|
||||||
|
.load(media.getImageLocation())
|
||||||
|
.apply(options)
|
||||||
|
.into(holder.image);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(EmbeddedChapterImage.getModelFor(media, position))
|
.load(EmbeddedChapterImage.getModelFor(media, position))
|
||||||
.apply(new RequestOptions()
|
.apply(options)
|
||||||
.dontAnimate()
|
|
||||||
.transform(new FitCenter(), new RoundedCorners((int)
|
|
||||||
(4 * context.getResources().getDisplayMetrics().density))))
|
|
||||||
.into(holder.image);
|
.into(holder.image);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue