Added 'type' attribute to Feed

This commit is contained in:
daniel oeh 2012-07-26 17:45:33 +02:00
parent 0cce685cc9
commit 30674e9356
3 changed files with 22 additions and 1 deletions

View File

@ -10,6 +10,9 @@ import java.util.Date;
* *
*/ */
public class Feed extends FeedFile { public class Feed extends FeedFile {
private static final String TYPE_RSS2 = "rss";
private static final String TYPE_ATOM1 = "atom";
private String title; private String title;
/** Link to the website. */ /** Link to the website. */
private String link; private String link;
@ -23,6 +26,8 @@ public class Feed extends FeedFile {
/** Date of last refresh. */ /** Date of last refresh. */
private Date lastUpdate; private Date lastUpdate;
private String paymentLink; private String paymentLink;
/** Feed type, for example RSS 2 or Atom */
private String type;
public Feed(Date lastUpdate) { public Feed(Date lastUpdate) {
super(); super();
@ -126,4 +131,14 @@ public class Feed extends FeedFile {
this.author = author; this.author = author;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
} }

View File

@ -591,6 +591,8 @@ public class FeedManager {
.getString(PodDBAdapter.KEY_AUTHOR_INDEX)); .getString(PodDBAdapter.KEY_AUTHOR_INDEX));
feed.setLanguage(feedlistCursor feed.setLanguage(feedlistCursor
.getString(PodDBAdapter.KEY_LANGUAGE_INDEX)); .getString(PodDBAdapter.KEY_LANGUAGE_INDEX));
feed.setType(feedlistCursor
.getString(PodDBAdapter.KEY_TYPE_INDEX));
long imageIndex = feedlistCursor long imageIndex = feedlistCursor
.getLong(PodDBAdapter.KEY_IMAGE_INDEX); .getLong(PodDBAdapter.KEY_IMAGE_INDEX);
if (imageIndex != 0) { if (imageIndex != 0) {

View File

@ -44,6 +44,7 @@ public class PodDBAdapter {
public static final int KEY_LANGUAGE_INDEX = 9; public static final int KEY_LANGUAGE_INDEX = 9;
public static final int KEY_AUTHOR_INDEX = 10; public static final int KEY_AUTHOR_INDEX = 10;
public static final int KEY_IMAGE_INDEX = 11; public static final int KEY_IMAGE_INDEX = 11;
public static final int KEY_TYPE_INDEX = 12;
// ----------- FeedItem indices // ----------- FeedItem indices
public static final int KEY_CONTENT_ENCODED_INDEX = 2; public static final int KEY_CONTENT_ENCODED_INDEX = 2;
public static final int KEY_PUBDATE_INDEX = 3; public static final int KEY_PUBDATE_INDEX = 3;
@ -101,6 +102,7 @@ public class PodDBAdapter {
public static final String KEY_LANGUAGE = "language"; public static final String KEY_LANGUAGE = "language";
public static final String KEY_AUTHOR = "author"; public static final String KEY_AUTHOR = "author";
public static final String KEY_HAS_SIMPLECHAPTERS = "has_simple_chapters"; public static final String KEY_HAS_SIMPLECHAPTERS = "has_simple_chapters";
public static final String KEY_TYPE = "type";
// Table names // Table names
public static final String TABLE_NAME_FEEDS = "Feeds"; public static final String TABLE_NAME_FEEDS = "Feeds";
@ -127,7 +129,8 @@ public class PodDBAdapter {
KEY_LASTUPDATE + " TEXT," + KEY_LASTUPDATE + " TEXT," +
KEY_LANGUAGE + " TEXT," + KEY_LANGUAGE + " TEXT," +
KEY_AUTHOR + " TEXT," + KEY_AUTHOR + " TEXT," +
KEY_IMAGE + " INTEGER)"; KEY_IMAGE + " INTEGER," +
KEY_TYPE + " TEXT)";
; ;
private static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " private static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE "
@ -238,6 +241,7 @@ public class PodDBAdapter {
values.put(KEY_DOWNLOAD_URL, feed.getDownload_url()); values.put(KEY_DOWNLOAD_URL, feed.getDownload_url());
values.put(KEY_DOWNLOADED, feed.isDownloaded()); values.put(KEY_DOWNLOADED, feed.isDownloaded());
values.put(KEY_LASTUPDATE, feed.getLastUpdate().getTime()); values.put(KEY_LASTUPDATE, feed.getLastUpdate().getTime());
values.put(KEY_TYPE, feed.getType());
if (feed.getId() == 0) { if (feed.getId() == 0) {
// Create new entry // Create new entry
if (AppConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db"); if (AppConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db");