Use proper plurals when showing number of episodes (#6922)

This commit is contained in:
ByteHamster 2024-02-16 23:50:12 +01:00 committed by GitHub
parent c07ae17962
commit c7c5ab567b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 10 deletions

View File

@ -33,7 +33,6 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.List; import java.util.List;
import java.util.Locale;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
@ -477,9 +476,8 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
} }
private void refreshInfoBar() { private void refreshInfoBar() {
String info = String.format(Locale.getDefault(), "%d%s", String info = getResources().getQuantityString(R.plurals.num_episodes, queue.size(), queue.size());
queue.size(), getString(R.string.episodes_suffix)); if (!queue.isEmpty()) {
if (queue.size() > 0) {
long timeLeft = 0; long timeLeft = 0;
for (FeedItem item : queue) { for (FeedItem item : queue) {
float playbackSpeed = 1; float playbackSpeed = 1;

View File

@ -123,7 +123,6 @@
<string name="description_label">Description</string> <string name="description_label">Description</string>
<string name="shownotes_label">Shownotes</string> <string name="shownotes_label">Shownotes</string>
<string name="shownotes_contentdescription">swipe up to read shownotes</string> <string name="shownotes_contentdescription">swipe up to read shownotes</string>
<string name="episodes_suffix">\u0020episodes</string>
<string name="close_label">Close</string> <string name="close_label">Close</string>
<string name="retry_label">Retry</string> <string name="retry_label">Retry</string>
<string name="auto_download_label">Include in auto downloads</string> <string name="auto_download_label">Include in auto downloads</string>

View File

@ -10,7 +10,6 @@ import de.danoeh.antennapod.ui.statistics.StatisticsListAdapter;
import de.danoeh.antennapod.ui.statistics.feed.FeedStatisticsDialogFragment; import de.danoeh.antennapod.ui.statistics.feed.FeedStatisticsDialogFragment;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
* Adapter for the download statistics list. * Adapter for the download statistics list.
@ -45,10 +44,10 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
@Override @Override
protected void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) { protected void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) {
holder.value.setText(Formatter.formatShortFileSize(context, item.totalDownloadSize) int numEpisodes = (int) item.episodesDownloadCount;
+ "" String text = Formatter.formatShortFileSize(context, item.totalDownloadSize);
+ String.format(Locale.getDefault(), "%d%s", text += "" + context.getResources().getQuantityString(R.plurals.num_episodes, numEpisodes, numEpisodes);
item.episodesDownloadCount, context.getString(R.string.episodes_suffix))); holder.value.setText(text);
holder.itemView.setOnClickListener(v -> { holder.itemView.setOnClickListener(v -> {
FeedStatisticsDialogFragment yourDialogFragment = FeedStatisticsDialogFragment.newInstance( FeedStatisticsDialogFragment yourDialogFragment = FeedStatisticsDialogFragment.newInstance(