summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authoravirajrsingh <69088913+avirajrsingh@users.noreply.github.com>2020-10-24 13:56:56 +0530
committerGitHub <noreply@github.com>2020-10-24 10:26:56 +0200
commit69a3c56d247e0f32c156c49a396c989d746ba96e (patch)
tree8009590bbd0b07d2a9b6af5585cbfa2828aa73b5 /core
parent75b7b41fa07da5d7f4b8a036ddb84bd846dda2a8 (diff)
downloadAntennaPod-69a3c56d247e0f32c156c49a396c989d746ba96e.zip
[Statistics]Add count of episodes stocked on device (#4581)
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java4
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java8
2 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
index c8368506b..fd8ca116d 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
@@ -746,6 +746,7 @@ public final class DBReader {
long episodesStarted = 0;
long episodesStartedIncludingMarked = 0;
long totalDownloadSize = 0;
+ long episodesDownloadCount = 0;
List<FeedItem> items = getFeed(feed.getId()).getItems();
for (FeedItem item : items) {
FeedMedia media = item.getMedia();
@@ -773,13 +774,14 @@ public final class DBReader {
if (media.isDownloaded()) {
totalDownloadSize = totalDownloadSize + media.getSize();
+ episodesDownloadCount++;
}
episodes++;
}
feedTime.add(new StatisticsItem(
feed, feedTotalTime, feedPlayedTime, feedPlayedTimeCountAll, episodes,
- episodesStarted, episodesStartedIncludingMarked, totalDownloadSize));
+ episodesStarted, episodesStartedIncludingMarked, totalDownloadSize, episodesDownloadCount));
}
adapter.close();
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java
index f96af185b..18a5403a7 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java
@@ -36,9 +36,14 @@ public class StatisticsItem {
*/
public final long totalDownloadSize;
+ /**
+ * Stores the number of episodes downloaded.
+ */
+ public final long episodesDownloadCount;
+
public StatisticsItem(Feed feed, long time, long timePlayed, long timePlayedCountAll,
long episodes, long episodesStarted, long episodesStartedIncludingMarked,
- long totalDownloadSize) {
+ long totalDownloadSize, long episodesDownloadCount) {
this.feed = feed;
this.time = time;
this.timePlayed = timePlayed;
@@ -47,5 +52,6 @@ public class StatisticsItem {
this.episodesStarted = episodesStarted;
this.episodesStartedIncludingMarked = episodesStartedIncludingMarked;
this.totalDownloadSize = totalDownloadSize;
+ this.episodesDownloadCount = episodesDownloadCount;
}
}