summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2016-01-31 19:25:26 -0500
committerTom Hennen <tom.hennen@gmail.com>2016-01-31 19:25:26 -0500
commit000633f60c4977e7e5a94675034669124ab69e2b (patch)
treebe904257fc6c9ca78cefffdd84635d47fb9bd86a /core
parent79b5328ecf26df8f59816b717f5a6fcf92694d91 (diff)
downloadAntennaPod-000633f60c4977e7e5a94675034669124ab69e2b.zip
don't query DB from the UI thread\!
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java8
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java4
5 files changed, 11 insertions, 7 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
index afb7c2f9d..80703e22d 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
@@ -32,7 +32,7 @@ public class APCleanupAlgorithm extends EpisodeCleanupAlgorithm {
/**
* @return the number of episodes that *could* be cleaned up, if needed
*/
- public int getAvailableSpace()
+ public int getReclaimableItems()
{
return getCandidates().size();
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java
index cd99c5a11..9cec62d83 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java
@@ -23,7 +23,7 @@ public class APNullCleanupAlgorithm extends EpisodeCleanupAlgorithm {
}
@Override
- public int getAvailableSpace() {
+ public int getReclaimableItems() {
return 0;
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java
index 9444278b7..baa9a986e 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java
@@ -26,7 +26,7 @@ public class APQueueCleanupAlgorithm extends EpisodeCleanupAlgorithm {
/**
* @return the number of episodes that *could* be cleaned up, if needed
*/
- public int getAvailableSpace()
+ public int getReclaimableItems()
{
return getCandidates().size();
}
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 0563f878f..68187306d 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
@@ -1017,7 +1017,8 @@ public final class DBReader {
int numNewItems = adapter.getNumberOfNewItems();
int numDownloadedItems = adapter.getNumberOfDownloadedEpisodes();
- NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, numDownloadedItems, feedCounters);
+ NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, numDownloadedItems,
+ feedCounters, UserPreferences.getEpisodeCleanupAlgorithm().getReclaimableItems());
adapter.close();
return result;
}
@@ -1028,17 +1029,20 @@ public final class DBReader {
public int numNewItems;
public int numDownloadedItems;
public LongIntMap feedCounters;
+ public int reclaimableSpace;
public NavDrawerData(List<Feed> feeds,
int queueSize,
int numNewItems,
int numDownloadedItems,
- LongIntMap feedIndicatorValues) {
+ LongIntMap feedIndicatorValues,
+ int reclaimableSpace) {
this.feeds = feeds;
this.queueSize = queueSize;
this.numNewItems = numNewItems;
this.numDownloadedItems = numDownloadedItems;
this.feedCounters = feedIndicatorValues;
+ this.reclaimableSpace = reclaimableSpace;
}
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java
index 065374381..97cbdca33 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java
@@ -40,9 +40,9 @@ public abstract class EpisodeCleanupAlgorithm {
}
/**
- * @return the number of episodes that *could* be cleaned up, if needed
+ * @return the number of episodes/items that *could* be cleaned up, if needed
*/
- public abstract int getAvailableSpace();
+ public abstract int getReclaimableItems();
/**
* @param amountOfRoomNeeded the number of episodes we want to download