Fixed default number of items to clean up
Not sure why this worked before TBH - but default value should naturally be to reduce to desired cache size. Probably makes no difference in actual use - but it is how the tests are constructed.
This commit is contained in:
parent
3a9e1fc2dd
commit
ae8759869d
|
@ -13,6 +13,7 @@ import java.util.Locale;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cleanup algorithm that removes any item that isn't a favorite but only if space is needed.
|
* A cleanup algorithm that removes any item that isn't a favorite but only if space is needed.
|
||||||
|
@ -86,6 +87,13 @@ public class ExceptFavoriteCleanupAlgorithm extends EpisodeCleanupAlgorithm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultCleanupParameter() {
|
public int getDefaultCleanupParameter() {
|
||||||
|
int cacheSize = UserPreferences.getEpisodeCacheSize();
|
||||||
|
if (cacheSize != UserPreferences.getEpisodeCacheSizeUnlimited()) {
|
||||||
|
int downloadedEpisodes = DBReader.getNumberOfDownloadedEpisodes();
|
||||||
|
if (downloadedEpisodes > cacheSize) {
|
||||||
|
return downloadedEpisodes - cacheSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue