diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java index f979aa1f3..c5e97e4a0 100644 --- a/src/de/danoeh/antennapod/feed/FeedManager.java +++ b/src/de/danoeh/antennapod/feed/FeedManager.java @@ -670,7 +670,9 @@ public class FeedManager { chapterCursor .getLong(PodDBAdapter.KEY_SC_START_INDEX), chapterCursor - .getString(PodDBAdapter.KEY_TITLE_INDEX)); + .getString(PodDBAdapter.KEY_TITLE_INDEX), + chapterCursor + .getString(PodDBAdapter.KEY_SC_LINK_INDEX)); item.getSimpleChapters().add(chapter); } while (chapterCursor.moveToNext()); } diff --git a/src/de/danoeh/antennapod/feed/SimpleChapter.java b/src/de/danoeh/antennapod/feed/SimpleChapter.java index 861d07eb2..96731d6e0 100644 --- a/src/de/danoeh/antennapod/feed/SimpleChapter.java +++ b/src/de/danoeh/antennapod/feed/SimpleChapter.java @@ -5,12 +5,14 @@ public class SimpleChapter extends FeedComponent { private long start; private String title; private FeedItem item; + private String link; - public SimpleChapter(FeedItem item, long start, String title) { + public SimpleChapter(FeedItem item, long start, String title, String link) { super(); this.item = item; this.start = start; this.title = title; + this.link = link; } public String getTitle() { @@ -29,4 +31,8 @@ public class SimpleChapter extends FeedComponent { this.item = item; } + public String getLink() { + return link; + } + } diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/src/de/danoeh/antennapod/storage/PodDBAdapter.java index 5ec1bab28..87376ea5c 100644 --- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java +++ b/src/de/danoeh/antennapod/storage/PodDBAdapter.java @@ -25,7 +25,7 @@ import android.util.Log; * */ public class PodDBAdapter { private static final String TAG = "PodDBAdapter"; - private static final int DATABASE_VERSION = 2; + private static final int DATABASE_VERSION = 3; private static final String DATABASE_NAME = "Antennapod.db"; @@ -69,6 +69,7 @@ public class PodDBAdapter { // --------- Simplechapters indices public static final int KEY_SC_START_INDEX = 2; public static final int KEY_SC_FEEDITEM_INDEX = 3; + public static final int KEY_SC_LINK_INDEX = 4; // Key-constants @@ -180,7 +181,8 @@ public class PodDBAdapter { + TABLE_NAME_SIMPLECHAPTERS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_START + " INTEGER," + - KEY_FEEDITEM + " INTEGER)"; + KEY_FEEDITEM + " INTEGER," + + KEY_LINK + " TEXT)"; /** * Used for storing download status entries to determine the type of the @@ -362,6 +364,7 @@ public class PodDBAdapter { values.put(KEY_TITLE, chapter.getTitle()); values.put(KEY_START, chapter.getStart()); values.put(KEY_FEEDITEM, item.getId()); + values.put(KEY_LINK, chapter.getLink()); if (chapter.getId() == 0) { chapter.setId(db .insert(TABLE_NAME_SIMPLECHAPTERS, null, values)); @@ -631,10 +634,14 @@ public class PodDBAdapter { final int newVersion) { Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to " + newVersion + "."); - if (oldVersion == 1) { + if (oldVersion <= 1) { db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS + " ADD COLUMN " + KEY_TYPE + " TEXT"); } + if (oldVersion <= 2) { + db.execSQL("ALTER TABLE " + TABLE_NAME_SIMPLECHAPTERS + " ADD COLUMN " + + KEY_LINK + " TEXT"); + } } } diff --git a/src/de/danoeh/antennapod/syndication/namespace/simplechapters/NSSimpleChapters.java b/src/de/danoeh/antennapod/syndication/namespace/simplechapters/NSSimpleChapters.java index 338715f52..f1fecf513 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/simplechapters/NSSimpleChapters.java +++ b/src/de/danoeh/antennapod/syndication/namespace/simplechapters/NSSimpleChapters.java @@ -18,6 +18,7 @@ public class NSSimpleChapters extends Namespace { public static final String CHAPTER = "chapter"; public static final String START = "start"; public static final String TITLE = "title"; + public static final String HREF = "href"; @Override public SyndElement handleElementStart(String localName, HandlerState state, @@ -31,7 +32,7 @@ public class NSSimpleChapters extends Namespace { .add(new SimpleChapter(state.getCurrentItem(), SyndDateUtils.parseTimeString(attributes .getValue(START)), attributes - .getValue(TITLE))); + .getValue(TITLE), attributes.getValue(HREF))); } return new SyndElement(localName, this);