Moved RSSHandler and FeedHandler to new package
This commit is contained in:
parent
e8db6ed778
commit
1d93445205
|
@ -29,6 +29,11 @@ public class FeedImage extends FeedFile {
|
|||
return title;
|
||||
}
|
||||
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Bitmap getImageBitmap() {
|
||||
if(image_bitmap == null) {
|
||||
image_bitmap = BitmapFactory.decodeFile(getFile_url());
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import de.podfetcher.feed.*;
|
||||
import de.podfetcher.storage.DownloadRequester;
|
||||
import de.podfetcher.syndication.FeedHandler;
|
||||
import android.app.Service;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Intent;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.podfetcher.feed;
|
||||
package de.podfetcher.syndication;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -9,6 +9,8 @@ import javax.xml.parsers.SAXParserFactory;
|
|||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import de.podfetcher.feed.Feed;
|
||||
|
||||
public class FeedHandler {
|
||||
public final static String CHANNEL = "channel";
|
||||
public final static String ITEM = "item";
|
||||
|
@ -29,7 +31,7 @@ public class FeedHandler {
|
|||
try {
|
||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
SAXParser saxParser = factory.newSAXParser();
|
||||
saxParser.parse(new File(feed.file_url), handler);
|
||||
saxParser.parse(new File(feed.getFile_url()), handler);
|
||||
} catch (SAXException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
|
@ -1,7 +1,11 @@
|
|||
package de.podfetcher.feed;
|
||||
package de.podfetcher.syndication;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import de.podfetcher.feed.FeedHandler;
|
||||
|
||||
import de.podfetcher.feed.Feed;
|
||||
import de.podfetcher.feed.FeedImage;
|
||||
import de.podfetcher.feed.FeedItem;
|
||||
import de.podfetcher.feed.FeedMedia;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -51,7 +55,7 @@ public class RSSHandler extends DefaultHandler {
|
|||
} else if(active_root_element.equalsIgnoreCase(FeedHandler.ITEM)) {
|
||||
currentItem.setTitle(strBuilder.toString());
|
||||
} else if(active_root_element.equalsIgnoreCase(FeedHandler.IMAGE)) {
|
||||
feed.getImage().title = strBuilder.toString();
|
||||
feed.getImage().setTitle(strBuilder.toString());
|
||||
}
|
||||
} else if (qName.equalsIgnoreCase(FeedHandler.DESCR)) {
|
||||
if (active_root_element.equalsIgnoreCase(FeedHandler.CHANNEL)) {
|
||||
|
@ -71,7 +75,7 @@ public class RSSHandler extends DefaultHandler {
|
|||
}
|
||||
} else if (qName.equalsIgnoreCase(FeedHandler.URL)) {
|
||||
if(active_root_element.equalsIgnoreCase(FeedHandler.IMAGE)) {
|
||||
feed.getImage().download_url = strBuilder.toString();
|
||||
feed.getImage().setDownload_url(strBuilder.toString());
|
||||
}
|
||||
} else if(qName.equalsIgnoreCase(FeedHandler.IMAGE)) {
|
||||
active_root_element = FeedHandler.CHANNEL;
|
Loading…
Reference in New Issue