From 0394726d151efba962b840838ed246eba0a24242 Mon Sep 17 00:00:00 2001 From: antonio Date: Sun, 4 Jun 2023 20:54:24 +0200 Subject: [PATCH] feat: added description in case of no podcast in the channel --- .../ui/fragment/PodcastChannelPageFragment.java | 13 ++++++++++--- .../res/layout/fragment_podcast_channel_page.xml | 11 +++++++++++ app/src/main/res/values/strings.xml | 6 +----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/play/ui/fragment/PodcastChannelPageFragment.java b/app/src/main/java/com/cappielloantonio/play/ui/fragment/PodcastChannelPageFragment.java index 8fda0663..848e9776 100644 --- a/app/src/main/java/com/cappielloantonio/play/ui/fragment/PodcastChannelPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/play/ui/fragment/PodcastChannelPageFragment.java @@ -21,6 +21,7 @@ import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.service.MediaManager; import com.cappielloantonio.play.service.MediaService; +import com.cappielloantonio.play.subsonic.models.PodcastEpisode; import com.cappielloantonio.play.ui.activity.MainActivity; import com.cappielloantonio.play.ui.adapter.PodcastEpisodeAdapter; import com.cappielloantonio.play.util.Constants; @@ -29,6 +30,7 @@ import com.cappielloantonio.play.util.UIUtil; import com.cappielloantonio.play.viewmodel.PodcastChannelPageViewModel; import com.google.common.util.concurrent.ListenableFuture; +import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -122,9 +124,14 @@ public class PodcastChannelPageFragment extends Fragment implements ClickCallbac bind.podcastChannelPageEpisodesPlaceholder.placeholder.setVisibility(View.GONE); if (!channels.isEmpty() && channels.get(0) != null && channels.get(0).getEpisodes() != null) { - if (bind != null) - bind.podcastChannelPageEpisodesSector.setVisibility(!channels.get(0).getEpisodes().isEmpty() ? View.VISIBLE : View.GONE); - podcastEpisodeAdapter.setItems(channels.get(0).getEpisodes().stream().filter(podcastEpisode -> Objects.equals(podcastEpisode.getStatus(), "completed")).collect(Collectors.toList())); + List availableEpisode = channels.get(0).getEpisodes().stream().filter(podcastEpisode -> Objects.equals(podcastEpisode.getStatus(), "completed")).collect(Collectors.toList()); + + if (bind != null) { + bind.podcastEpisodesRecyclerView.setVisibility(availableEpisode.isEmpty() ? View.GONE : View.VISIBLE); + bind.podcastEpisodesAvailabilityTextView.setVisibility(availableEpisode.isEmpty() ? View.VISIBLE : View.GONE); + } + + podcastEpisodeAdapter.setItems(availableEpisode); } } }); diff --git a/app/src/main/res/layout/fragment_podcast_channel_page.xml b/app/src/main/res/layout/fragment_podcast_channel_page.xml index 84e31b4d..aef4e8d0 100644 --- a/app/src/main/res/layout/fragment_podcast_channel_page.xml +++ b/app/src/main/res/layout/fragment_podcast_channel_page.xml @@ -116,6 +116,17 @@ android:clipToPadding="false" android:nestedScrollingEnabled="false" android:paddingTop="8dp" /> + + Channels Description Episodes + No episodes available RSS Url Podcast Channel %1$s • %2$s - Once you add a channel, you\'ll find it here No podcasts found! Click to hide the section\nThe effects will be visible on restart - Radio Name Radio Stream URL Radio Homepage URL @@ -140,12 +139,9 @@ Delete Save Internet Radio Station - Once you add a radio station, you\'ll find it here No stations found! Click to hide the section\nThe effects will be visible on restart - - Cancel Save Rate