Permalink
Browse files

Moved PodcastProperties into the PodcastLoaderPlatform

  • Loading branch information...
1 parent ba95d75 commit 2aa9fdae9a858aebfcd9ffe16b3eb9ce15944022 @tindandelion committed Oct 9, 2012
@@ -1,27 +0,0 @@
-package org.dandelion.radiot.podcasts.main;
-
-import java.util.HashMap;
-
-public class PodcastProperties {
- private static HashMap<String, PodcastProperties> shows;
-
- public String name;
- public String url;
-
- static {
- shows = new HashMap<String, PodcastProperties>();
- shows.put("main-show",
- new PodcastProperties("main-show", "http://feeds.rucast.net/radio-t"));
- shows.put("after-show",
- new PodcastProperties("after-show", "http://feeds.feedburner.com/pirate-radio-t"));
- }
-
- public static PodcastProperties propertiesForShow(String name) {
- return shows.get(name);
- }
-
- private PodcastProperties(String name, String url) {
- this.name = name;
- this.url = url;
- }
-}
@@ -4,11 +4,23 @@
import org.dandelion.radiot.podcasts.loader.*;
import java.io.File;
+import java.util.HashMap;
public class PodcastsLoaderPlatform implements LoaderFactory {
private static final int CACHE_FORMAT_VERSION = 5;
private static final String THUMBNAIL_HOST = "http://www.radio-t.com";
+ private static HashMap<String, PodcastProperties> shows;
+ static {
+ shows = new HashMap<String, PodcastProperties>();
+ shows.put("main-show",
+ new PodcastProperties("main-show",
+ "http://feeds.rucast.net/radio-t"));
+ shows.put("after-show",
+ new PodcastProperties("after-show",
+ "http://feeds.feedburner.com/pirate-radio-t"));
+ }
+
private Context context;
public PodcastsLoaderPlatform(Context context) {
@@ -17,10 +29,14 @@ public PodcastsLoaderPlatform(Context context) {
@Override
public PodcastListLoader createLoaderForShow(String name) {
- PodcastProperties props = PodcastProperties.propertiesForShow(name);
+ PodcastProperties props = propertiesForShow(name);
return createPodcastLoader(props);
}
+ private PodcastProperties propertiesForShow(String name) {
+ return shows.get(name);
+ }
+
private PodcastListLoader createPodcastLoader(PodcastProperties props) {
HttpThumbnailProvider thumbnails = new HttpThumbnailProvider(THUMBNAIL_HOST);
return new AsyncPodcastListLoader(
@@ -32,4 +48,14 @@ private PodcastsCache createPodcastsCache(String name) {
File cacheFile = new File(context.getCacheDir(), name);
return new FilePodcastsCache(cacheFile, CACHE_FORMAT_VERSION);
}
+
+ private static class PodcastProperties {
+ public String name;
+ public String url;
+
+ public PodcastProperties(String name, String url) {
+ this.name = name;
+ this.url = url;
+ }
+ }
}

0 comments on commit 2aa9fda

Please sign in to comment.