Added support for 'href' attribute for simple chapters
This commit is contained in:
parent
83d67a2921
commit
9f84f3733f
|
@ -670,7 +670,9 @@ public class FeedManager {
|
||||||
chapterCursor
|
chapterCursor
|
||||||
.getLong(PodDBAdapter.KEY_SC_START_INDEX),
|
.getLong(PodDBAdapter.KEY_SC_START_INDEX),
|
||||||
chapterCursor
|
chapterCursor
|
||||||
.getString(PodDBAdapter.KEY_TITLE_INDEX));
|
.getString(PodDBAdapter.KEY_TITLE_INDEX),
|
||||||
|
chapterCursor
|
||||||
|
.getString(PodDBAdapter.KEY_SC_LINK_INDEX));
|
||||||
item.getSimpleChapters().add(chapter);
|
item.getSimpleChapters().add(chapter);
|
||||||
} while (chapterCursor.moveToNext());
|
} while (chapterCursor.moveToNext());
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,14 @@ public class SimpleChapter extends FeedComponent {
|
||||||
private long start;
|
private long start;
|
||||||
private String title;
|
private String title;
|
||||||
private FeedItem item;
|
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();
|
super();
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
|
@ -29,4 +31,8 @@ public class SimpleChapter extends FeedComponent {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLink() {
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import android.util.Log;
|
||||||
* */
|
* */
|
||||||
public class PodDBAdapter {
|
public class PodDBAdapter {
|
||||||
private static final String TAG = "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";
|
private static final String DATABASE_NAME = "Antennapod.db";
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ public class PodDBAdapter {
|
||||||
// --------- Simplechapters indices
|
// --------- Simplechapters indices
|
||||||
public static final int KEY_SC_START_INDEX = 2;
|
public static final int KEY_SC_START_INDEX = 2;
|
||||||
public static final int KEY_SC_FEEDITEM_INDEX = 3;
|
public static final int KEY_SC_FEEDITEM_INDEX = 3;
|
||||||
|
public static final int KEY_SC_LINK_INDEX = 4;
|
||||||
|
|
||||||
|
|
||||||
// Key-constants
|
// Key-constants
|
||||||
|
@ -180,7 +181,8 @@ public class PodDBAdapter {
|
||||||
+ TABLE_NAME_SIMPLECHAPTERS + " (" + TABLE_PRIMARY_KEY +
|
+ TABLE_NAME_SIMPLECHAPTERS + " (" + TABLE_PRIMARY_KEY +
|
||||||
KEY_TITLE + " TEXT," +
|
KEY_TITLE + " TEXT," +
|
||||||
KEY_START + " INTEGER," +
|
KEY_START + " INTEGER," +
|
||||||
KEY_FEEDITEM + " INTEGER)";
|
KEY_FEEDITEM + " INTEGER," +
|
||||||
|
KEY_LINK + " TEXT)";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for storing download status entries to determine the type of the
|
* 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_TITLE, chapter.getTitle());
|
||||||
values.put(KEY_START, chapter.getStart());
|
values.put(KEY_START, chapter.getStart());
|
||||||
values.put(KEY_FEEDITEM, item.getId());
|
values.put(KEY_FEEDITEM, item.getId());
|
||||||
|
values.put(KEY_LINK, chapter.getLink());
|
||||||
if (chapter.getId() == 0) {
|
if (chapter.getId() == 0) {
|
||||||
chapter.setId(db
|
chapter.setId(db
|
||||||
.insert(TABLE_NAME_SIMPLECHAPTERS, null, values));
|
.insert(TABLE_NAME_SIMPLECHAPTERS, null, values));
|
||||||
|
@ -631,10 +634,14 @@ public class PodDBAdapter {
|
||||||
final int newVersion) {
|
final int newVersion) {
|
||||||
Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to "
|
Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to "
|
||||||
+ newVersion + ".");
|
+ newVersion + ".");
|
||||||
if (oldVersion == 1) {
|
if (oldVersion <= 1) {
|
||||||
db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS + " ADD COLUMN " +
|
db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS + " ADD COLUMN " +
|
||||||
KEY_TYPE + " TEXT");
|
KEY_TYPE + " TEXT");
|
||||||
}
|
}
|
||||||
|
if (oldVersion <= 2) {
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_NAME_SIMPLECHAPTERS + " ADD COLUMN " +
|
||||||
|
KEY_LINK + " TEXT");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class NSSimpleChapters extends Namespace {
|
||||||
public static final String CHAPTER = "chapter";
|
public static final String CHAPTER = "chapter";
|
||||||
public static final String START = "start";
|
public static final String START = "start";
|
||||||
public static final String TITLE = "title";
|
public static final String TITLE = "title";
|
||||||
|
public static final String HREF = "href";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SyndElement handleElementStart(String localName, HandlerState state,
|
public SyndElement handleElementStart(String localName, HandlerState state,
|
||||||
|
@ -31,7 +32,7 @@ public class NSSimpleChapters extends Namespace {
|
||||||
.add(new SimpleChapter(state.getCurrentItem(),
|
.add(new SimpleChapter(state.getCurrentItem(),
|
||||||
SyndDateUtils.parseTimeString(attributes
|
SyndDateUtils.parseTimeString(attributes
|
||||||
.getValue(START)), attributes
|
.getValue(START)), attributes
|
||||||
.getValue(TITLE)));
|
.getValue(TITLE), attributes.getValue(HREF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SyndElement(localName, this);
|
return new SyndElement(localName, this);
|
||||||
|
|
Loading…
Reference in New Issue