From a671be2d792a4a5951993af437950d41fb88fc7b Mon Sep 17 00:00:00 2001 From: Tony Tam <149837+tonytamsf@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:15:03 -0700 Subject: [PATCH] Show the number of downloaded episodes in stats screen (#7435) --- ui/i18n/src/main/res/values/strings.xml | 5 ++++- .../statistics/downloads/DownloadStatisticsListAdapter.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 42cab5f25..70628a198 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -77,7 +77,10 @@ Shown - Total size of episodes on the device + + Total size of %d episode on the device + Total size of %d episodes on the device + Open menu diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java index 2af3f0bf7..4ab6f3a13 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java @@ -16,6 +16,7 @@ import java.util.List; */ public class DownloadStatisticsListAdapter extends StatisticsListAdapter { private final Fragment fragment; + private int cacheEpisodes; public DownloadStatisticsListAdapter(Context context, Fragment fragment) { super(context); @@ -24,7 +25,8 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter { @Override protected String getHeaderCaption() { - return context.getString(R.string.total_size_downloaded_podcasts); + return context.getResources().getQuantityString( + R.plurals.total_size_downloaded_podcasts, cacheEpisodes, cacheEpisodes); } @Override @@ -35,9 +37,11 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter { @Override protected PieChartView.PieChartData generateChartData(List statisticsData) { float[] dataValues = new float[statisticsData.size()]; + cacheEpisodes = 0; for (int i = 0; i < statisticsData.size(); i++) { StatisticsItem item = statisticsData.get(i); dataValues[i] = item.totalDownloadSize; + cacheEpisodes += item.episodesDownloadCount; } return new PieChartView.PieChartData(dataValues); }