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