summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Tam <149837+tonytamsf@users.noreply.github.com>2024-10-04 12:15:03 -0700
committerGitHub <noreply@github.com>2024-10-04 21:15:03 +0200
commita671be2d792a4a5951993af437950d41fb88fc7b (patch)
treedde67faf1e11193d74e68f239db6c0653636e505
parent4990d95f33bd6abef19cb14ccc0dbe4d85c5414e (diff)
downloadAntennaPod-a671be2d792a4a5951993af437950d41fb88fc7b.zip
Show the number of downloaded episodes in stats screen (#7435)
-rw-r--r--ui/i18n/src/main/res/values/strings.xml5
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/downloads/DownloadStatisticsListAdapter.java6
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 @@
<string name="section_shown">Shown</string>
<!-- Download Statistics fragment -->
- <string name="total_size_downloaded_podcasts">Total size of episodes on the device</string>
+ <plurals name="total_size_downloaded_podcasts">
+ <item quantity="one">Total size of %d episode on the device</item>
+ <item quantity="other">Total size of %d episodes on the device</item>
+ </plurals>
<!-- Main activity -->
<string name="drawer_open">Open menu</string>
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<StatisticsItem> 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);
}