aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java17
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/MusicService.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java4
5 files changed, 17 insertions, 10 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java
index 25be47b1..2e2a16b3 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java
@@ -175,7 +175,7 @@ public class SelectPodcastsFragment extends SelectRecyclerFragment<Serializable>
if(!Util.isOffline(context) && ServerInfo.hasNewestPodcastEpisodes(context)) {
try {
- newestEpisodes = musicService.getNewestPodcastEpisodes(10, context, listener);
+ newestEpisodes = musicService.getNewestPodcastEpisodes(refresh, context, listener, 10);
for(MusicDirectory.Entry entry: newestEpisodes.getChildren()) {
for(PodcastChannel channel: channels) {
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
index 3be04cff..1a17dfb3 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
@@ -22,8 +22,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -59,7 +57,6 @@ import github.daneren2005.dsub.util.SongDBHandler;
import github.daneren2005.dsub.util.SyncUtil;
import github.daneren2005.dsub.util.TimeLimitedCache;
import github.daneren2005.dsub.util.FileUtil;
-import github.daneren2005.dsub.util.UpdateHelper;
import github.daneren2005.dsub.util.Util;
import static github.daneren2005.dsub.domain.MusicDirectory.Entry;
@@ -926,8 +923,18 @@ public class CachedMusicService implements MusicService {
}
@Override
- public MusicDirectory getNewestPodcastEpisodes(int count, Context context, ProgressListener progressListener) throws Exception {
- return musicService.getNewestPodcastEpisodes(count, context, progressListener);
+ public MusicDirectory getNewestPodcastEpisodes(boolean refresh, Context context, ProgressListener progressListener, int count) throws Exception {
+ MusicDirectory result = null;
+
+ String cacheName = getCacheName(context, "newestPodcastEpisodes");
+ try {
+ result = musicService.getNewestPodcastEpisodes(refresh, context, progressListener, count);
+ FileUtil.serialize(context, result, cacheName);
+ } catch(IOException e) {
+ result = FileUtil.deserialize(context, cacheName, MusicDirectory.class, 24);
+ } finally {
+ return result;
+ }
}
@Override
diff --git a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
index 876b45fd..22f154c4 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
@@ -149,7 +149,7 @@ public interface MusicService {
MusicDirectory getPodcastEpisodes(boolean refresh, String id, Context context, ProgressListener progressListener) throws Exception;
- MusicDirectory getNewestPodcastEpisodes(int count, Context context, ProgressListener progressListener) throws Exception;
+ MusicDirectory getNewestPodcastEpisodes(boolean refresh, Context context, ProgressListener progressListener, int count) throws Exception;
void refreshPodcasts(Context context, ProgressListener progressListener) throws Exception;
diff --git a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
index e1929bf8..e004101d 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -775,7 +775,7 @@ public class OfflineMusicService implements MusicService {
}
@Override
- public MusicDirectory getNewestPodcastEpisodes(int count, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getNewestPodcastEpisodes(boolean refresh, Context context, ProgressListener progressListener, int count) throws Exception {
throw new OfflineException(ERRORMSG);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 1d9fd4af..4c3a121d 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1336,8 +1336,8 @@ public class RESTMusicService implements MusicService {
}
@Override
- public MusicDirectory getNewestPodcastEpisodes(int count, Context context, ProgressListener progressListener) throws Exception {
- Reader reader = getReader(context, progressListener, "getNewestPodcasts", null, Arrays.asList("count"), Arrays.<Object>asList(count));
+ public MusicDirectory getNewestPodcastEpisodes(boolean refresh, Context context, ProgressListener progressListener, int count) throws Exception {
+ Reader reader = getReader(context, progressListener, "getNewestPodcasts", null, Arrays.asList("count"), Arrays.<Object>asList(count), true);
try {
return new PodcastEntryParser(context, getInstance(context)).parse(null, reader, progressListener);