diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/DownloadsSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/DownloadsSection.java index 06de7803a..af497bbe8 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/DownloadsSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/DownloadsSection.java @@ -6,36 +6,39 @@ import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter; -import de.danoeh.antennapod.event.DownloadLogEvent; -import de.danoeh.antennapod.ui.MenuItemUtils; -import de.danoeh.antennapod.storage.database.DBReader; -import de.danoeh.antennapod.event.FeedItemEvent; -import de.danoeh.antennapod.event.PlayerStatusEvent; -import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; -import de.danoeh.antennapod.ui.screen.download.CompletedDownloadsFragment; -import de.danoeh.antennapod.ui.swipeactions.SwipeActions; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.model.feed.FeedItemFilter; -import de.danoeh.antennapod.model.feed.SortOrder; -import de.danoeh.antennapod.storage.preferences.UserPreferences; -import de.danoeh.antennapod.ui.screen.home.HomeSection; -import de.danoeh.antennapod.ui.episodeslist.EpisodeItemViewHolder; -import io.reactivex.Observable; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; -import io.reactivex.schedulers.Schedulers; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.util.List; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.event.DownloadLogEvent; +import de.danoeh.antennapod.event.FeedItemEvent; +import de.danoeh.antennapod.event.PlayerStatusEvent; +import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItemFilter; +import de.danoeh.antennapod.model.feed.SortOrder; +import de.danoeh.antennapod.storage.database.DBReader; +import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.ui.MenuItemUtils; +import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter; +import de.danoeh.antennapod.ui.episodeslist.EpisodeItemViewHolder; +import de.danoeh.antennapod.ui.screen.download.CompletedDownloadsFragment; +import de.danoeh.antennapod.ui.screen.home.HomeSection; +import de.danoeh.antennapod.ui.swipeactions.SwipeActions; +import io.reactivex.Observable; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; +import io.reactivex.schedulers.Schedulers; + public class DownloadsSection extends HomeSection { public static final String TAG = "DownloadsSection"; private static final int NUM_EPISODES = 2; @@ -63,6 +66,7 @@ public class DownloadsSection extends HomeSection { }; adapter.setDummyViews(NUM_EPISODES); viewBinding.recyclerView.setAdapter(adapter); + viewBinding.emptyLabel.setText(R.string.home_downloads_empty_text); SwipeActions swipeActions = new SwipeActions(this, CompletedDownloadsFragment.TAG); swipeActions.attachTo(viewBinding.recyclerView); @@ -133,6 +137,7 @@ public class DownloadsSection extends HomeSection { items = downloads; adapter.setDummyViews(0); adapter.updateItems(items); + viewBinding.emptyLabel.setVisibility(items.isEmpty() ? View.VISIBLE : View.GONE); }, error -> Log.e(TAG, Log.getStackTraceString(error))); } } diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java index 09f060f81..1f1a633c7 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java @@ -6,27 +6,12 @@ import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter; -import de.danoeh.antennapod.ui.MenuItemUtils; -import de.danoeh.antennapod.storage.database.DBReader; -import de.danoeh.antennapod.event.EpisodeDownloadEvent; -import de.danoeh.antennapod.event.FeedItemEvent; -import de.danoeh.antennapod.event.PlayerStatusEvent; -import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; -import de.danoeh.antennapod.ui.screen.AllEpisodesFragment; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.ui.screen.home.HomeSection; -import de.danoeh.antennapod.ui.episodeslist.HorizontalItemViewHolder; -import io.reactivex.Observable; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; -import io.reactivex.schedulers.Schedulers; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -34,6 +19,24 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.event.EpisodeDownloadEvent; +import de.danoeh.antennapod.event.FeedItemEvent; +import de.danoeh.antennapod.event.PlayerStatusEvent; +import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.storage.database.DBReader; +import de.danoeh.antennapod.ui.MenuItemUtils; +import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter; +import de.danoeh.antennapod.ui.episodeslist.HorizontalItemViewHolder; +import de.danoeh.antennapod.ui.screen.AllEpisodesFragment; +import de.danoeh.antennapod.ui.screen.home.HomeSection; +import io.reactivex.Observable; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; +import io.reactivex.schedulers.Schedulers; + public class EpisodesSurpriseSection extends HomeSection { public static final String TAG = "EpisodesSurpriseSection"; private static final int NUM_EPISODES = 8; @@ -69,6 +72,7 @@ public class EpisodesSurpriseSection extends HomeSection { if (seed == 0) { seed = new Random().nextInt(); } + viewBinding.emptyLabel.setText(R.string.home_no_recent_unplayed_episodes_text); return view; } @@ -149,6 +153,11 @@ public class EpisodesSurpriseSection extends HomeSection { this.episodes = episodes; listAdapter.setDummyViews(0); listAdapter.updateData(episodes); + + boolean isShuffleable = !episodes.isEmpty(); + viewBinding.shuffleButton.setVisibility(isShuffleable ? View.VISIBLE : View.GONE); + viewBinding.recyclerView.setVisibility(isShuffleable ? View.VISIBLE : View.GONE); + viewBinding.emptyLabel.setVisibility(!isShuffleable ? View.VISIBLE : View.GONE); }, error -> Log.e(TAG, Log.getStackTraceString(error))); } } diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java index d30fa85bc..7bb791746 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java @@ -6,30 +6,13 @@ import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.util.Pair; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter; -import de.danoeh.antennapod.ui.MenuItemUtils; -import de.danoeh.antennapod.storage.database.DBReader; -import de.danoeh.antennapod.event.EpisodeDownloadEvent; -import de.danoeh.antennapod.event.FeedItemEvent; -import de.danoeh.antennapod.event.FeedListUpdateEvent; -import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; -import de.danoeh.antennapod.ui.screen.InboxFragment; -import de.danoeh.antennapod.ui.swipeactions.SwipeActions; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.model.feed.FeedItemFilter; -import de.danoeh.antennapod.storage.preferences.UserPreferences; -import de.danoeh.antennapod.ui.screen.home.HomeSection; -import io.reactivex.Observable; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; -import io.reactivex.schedulers.Schedulers; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -37,6 +20,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.event.EpisodeDownloadEvent; +import de.danoeh.antennapod.event.FeedItemEvent; +import de.danoeh.antennapod.event.FeedListUpdateEvent; +import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItemFilter; +import de.danoeh.antennapod.storage.database.DBReader; +import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.ui.MenuItemUtils; +import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter; +import de.danoeh.antennapod.ui.screen.InboxFragment; +import de.danoeh.antennapod.ui.screen.home.HomeSection; +import de.danoeh.antennapod.ui.swipeactions.SwipeActions; +import io.reactivex.Observable; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; +import io.reactivex.schedulers.Schedulers; + public class InboxSection extends HomeSection { public static final String TAG = "InboxSection"; private static final int NUM_EPISODES = 2; @@ -53,7 +56,7 @@ public class InboxSection extends HomeSection { viewBinding.recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER); viewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); viewBinding.recyclerView.setRecycledViewPool(((MainActivity) requireActivity()).getRecycledViewPool()); - adapter = new EpisodeItemListAdapter((MainActivity) requireActivity()) { + adapter = new EpisodeItemListAdapter(requireActivity()) { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); @@ -62,6 +65,7 @@ public class InboxSection extends HomeSection { }; adapter.setDummyViews(NUM_EPISODES); viewBinding.recyclerView.setAdapter(adapter); + viewBinding.emptyLabel.setText(R.string.home_new_empty_text); SwipeActions swipeActions = new SwipeActions(this, InboxFragment.TAG); swipeActions.attachTo(viewBinding.recyclerView); @@ -129,7 +133,8 @@ public class InboxSection extends HomeSection { items = data.first; adapter.setDummyViews(0); adapter.updateItems(items); - viewBinding.numNewItemsLabel.setVisibility(View.VISIBLE); + viewBinding.emptyLabel.setVisibility(items.isEmpty() ? View.VISIBLE : View.GONE); + viewBinding.numNewItemsLabel.setVisibility(!items.isEmpty() ? View.VISIBLE : View.GONE); if (data.second >= 100) { viewBinding.numNewItemsLabel.setText(String.format(Locale.getDefault(), "%d+", 99)); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java index 790992420..a06f4baba 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java @@ -59,6 +59,7 @@ public class QueueSection extends HomeSection { viewBinding.recyclerView.setAdapter(listAdapter); int paddingHorizontal = (int) (12 * getResources().getDisplayMetrics().density); viewBinding.recyclerView.setPadding(paddingHorizontal, 0, paddingHorizontal, 0); + viewBinding.emptyLabel.setText(R.string.home_continue_empty_text); return view; } @@ -156,6 +157,7 @@ public class QueueSection extends HomeSection { this.queue = queue; listAdapter.setDummyViews(0); listAdapter.updateData(queue); + viewBinding.emptyLabel.setVisibility(queue.isEmpty() ? View.VISIBLE : View.GONE); }, error -> Log.e(TAG, Log.getStackTraceString(error))); } diff --git a/app/src/main/res/layout/home_section.xml b/app/src/main/res/layout/home_section.xml index f8379b0ff..3064b7d44 100644 --- a/app/src/main/res/layout/home_section.xml +++ b/app/src/main/res/layout/home_section.xml @@ -106,4 +106,14 @@ tools:listitem="@layout/horizontal_itemlist_item" tools:itemCount="1" /> + + diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index ea9d23fb0..8b0fbf25b 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -61,6 +61,10 @@ Continue listening See what\'s new Manage downloads + You already played all recent episodes. Nothing to be surprised here ;) + You can add episodes by downloading them or long-pressing them and selecting \"Add to queue\". + New episodes will show up here. You can then decide whether you are interested in them. + You can download any episode to listen to it offline. Welcome to AntennaPod! You are not subscribed to any podcasts yet. Open the side menu to add a podcast. AntennaPod needs your permission to show notifications. By default, AntennaPod only shows notifications while something is being downloaded or when something goes wrong.