feat: added description in case of no podcast in the channel

This commit is contained in:
antonio 2023-06-04 20:54:24 +02:00
parent df4ef74dd2
commit 0394726d15
3 changed files with 22 additions and 8 deletions

View file

@ -21,6 +21,7 @@ import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.service.MediaManager; import com.cappielloantonio.play.service.MediaManager;
import com.cappielloantonio.play.service.MediaService; 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.activity.MainActivity;
import com.cappielloantonio.play.ui.adapter.PodcastEpisodeAdapter; import com.cappielloantonio.play.ui.adapter.PodcastEpisodeAdapter;
import com.cappielloantonio.play.util.Constants; import com.cappielloantonio.play.util.Constants;
@ -29,6 +30,7 @@ import com.cappielloantonio.play.util.UIUtil;
import com.cappielloantonio.play.viewmodel.PodcastChannelPageViewModel; import com.cappielloantonio.play.viewmodel.PodcastChannelPageViewModel;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -122,9 +124,14 @@ public class PodcastChannelPageFragment extends Fragment implements ClickCallbac
bind.podcastChannelPageEpisodesPlaceholder.placeholder.setVisibility(View.GONE); bind.podcastChannelPageEpisodesPlaceholder.placeholder.setVisibility(View.GONE);
if (!channels.isEmpty() && channels.get(0) != null && channels.get(0).getEpisodes() != null) { if (!channels.isEmpty() && channels.get(0) != null && channels.get(0).getEpisodes() != null) {
if (bind != null) List<PodcastEpisode> availableEpisode = channels.get(0).getEpisodes().stream().filter(podcastEpisode -> Objects.equals(podcastEpisode.getStatus(), "completed")).collect(Collectors.toList());
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())); if (bind != null) {
bind.podcastEpisodesRecyclerView.setVisibility(availableEpisode.isEmpty() ? View.GONE : View.VISIBLE);
bind.podcastEpisodesAvailabilityTextView.setVisibility(availableEpisode.isEmpty() ? View.VISIBLE : View.GONE);
}
podcastEpisodeAdapter.setItems(availableEpisode);
} }
} }
}); });

View file

@ -116,6 +116,17 @@
android:clipToPadding="false" android:clipToPadding="false"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
android:paddingTop="8dp" /> android:paddingTop="8dp" />
<TextView
android:id="@+id/podcast_episodes_availability_text_view"
style="@style/TitleMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingStart="16dp"
android:paddingEnd="8dp"
android:text="@string/podcast_channel_page_title_no_episode_available"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<include <include

View file

@ -125,14 +125,13 @@
<string name="podcast_channel_catalogue_title">Channels</string> <string name="podcast_channel_catalogue_title">Channels</string>
<string name="podcast_channel_page_title_description_section">Description</string> <string name="podcast_channel_page_title_description_section">Description</string>
<string name="podcast_channel_page_title_episode_section">Episodes</string> <string name="podcast_channel_page_title_episode_section">Episodes</string>
<string name="podcast_channel_page_title_no_episode_available">No episodes available</string>
<string name="podcast_channel_editor_dialog_hint_rss_url">RSS Url</string> <string name="podcast_channel_editor_dialog_hint_rss_url">RSS Url</string>
<string name="podcast_channel_editor_dialog_title">Podcast Channel</string> <string name="podcast_channel_editor_dialog_title">Podcast Channel</string>
<string name="podcast_release_date_duration_formatter">%1$s • %2$s</string> <string name="podcast_release_date_duration_formatter">%1$s • %2$s</string>
<string name="podcast_info_empty_subtitle">Once you add a channel, you\'ll find it here</string> <string name="podcast_info_empty_subtitle">Once you add a channel, you\'ll find it here</string>
<string name="podcast_info_empty_title">No podcasts found!</string> <string name="podcast_info_empty_title">No podcasts found!</string>
<string name="podcast_info_empty_button">Click to hide the section\nThe effects will be visible on restart</string> <string name="podcast_info_empty_button">Click to hide the section\nThe effects will be visible on restart</string>
<string name="radio_editor_dialog_hint_name">Radio Name</string> <string name="radio_editor_dialog_hint_name">Radio Name</string>
<string name="radio_editor_dialog_hint_stream_url">Radio Stream URL</string> <string name="radio_editor_dialog_hint_stream_url">Radio Stream URL</string>
<string name="radio_editor_dialog_hint_homepage_url">Radio Homepage URL</string> <string name="radio_editor_dialog_hint_homepage_url">Radio Homepage URL</string>
@ -140,12 +139,9 @@
<string name="radio_editor_dialog_neutral_button">Delete</string> <string name="radio_editor_dialog_neutral_button">Delete</string>
<string name="radio_editor_dialog_positive_button">Save</string> <string name="radio_editor_dialog_positive_button">Save</string>
<string name="radio_editor_dialog_title">Internet Radio Station</string> <string name="radio_editor_dialog_title">Internet Radio Station</string>
<string name="radio_station_info_empty_subtitle">Once you add a radio station, you\'ll find it here</string> <string name="radio_station_info_empty_subtitle">Once you add a radio station, you\'ll find it here</string>
<string name="radio_station_info_empty_title">No stations found!</string> <string name="radio_station_info_empty_title">No stations found!</string>
<string name="radio_station_info_empty_button">Click to hide the section\nThe effects will be visible on restart</string> <string name="radio_station_info_empty_button">Click to hide the section\nThe effects will be visible on restart</string>
<string name="rating_dialog_negative_button">Cancel</string> <string name="rating_dialog_negative_button">Cancel</string>
<string name="rating_dialog_positive_button">Save</string> <string name="rating_dialog_positive_button">Save</string>
<string name="rating_dialog_title">Rate</string> <string name="rating_dialog_title">Rate</string>