Added documentation to DBWriter

This commit is contained in:
daniel oeh 2013-08-09 21:51:13 +02:00
parent ce9f87ff3e
commit fa155f833b
4 changed files with 646 additions and 503 deletions

View File

@ -775,7 +775,6 @@ public class PlaybackService extends Service {
if (media instanceof FeedMedia) {
FeedItem item = ((FeedMedia) media).getItem();
((FeedMedia) media).setPlaybackCompletionDate(new Date());
DBWriter.markItemRead(PlaybackService.this, item, true, true);
nextItem = DBTasks.getQueueSuccessorOfItem(this, item.getId(), queue);
isInQueue = media instanceof FeedMedia
@ -783,7 +782,7 @@ public class PlaybackService extends Service {
if (isInQueue) {
DBWriter.removeQueueItem(PlaybackService.this, item.getId(), true);
}
DBWriter.addItemToPlaybackHistory(PlaybackService.this, item);
DBWriter.addItemToPlaybackHistory(PlaybackService.this, (FeedMedia) media);
DBWriter.setFeedMedia(PlaybackService.this, (FeedMedia) media);
long autoDeleteMediaId = ((FeedComponent) media).getId();
if (shouldStream) {

View File

@ -27,6 +27,8 @@ import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator;
* Provides methods for reading data from the AntennaPod database.
* In general, all database calls in DBReader-methods are executed on the caller's thread.
* This means that the caller should make sure that DBReader-methods are not executed on the GUI-thread.
* This class will use the {@link de.danoeh.antennapod.feed.EventDistributor} to notify listeners about changes in the database.
*/
public final class DBReader {
private static final String TAG = "DBReader";

File diff suppressed because it is too large Load Diff

View File

@ -438,7 +438,7 @@ public class PodDBAdapter {
}
values.put(KEY_PUBDATE, item.getPubDate().getTime());
values.put(KEY_PAYMENT_LINK, item.getPaymentLink());
if (item.getFeed().getId() == 0) {
if (item.getFeed() != null) {
setFeed(item.getFeed());
}
values.put(KEY_FEED, item.getFeed().getId());
@ -452,9 +452,7 @@ public class PodDBAdapter {
new String[]{String.valueOf(item.getId())});
}
if (item.getMedia() != null) {
if (item.getMedia().getId() == 0) {
setMedia(item.getMedia());
}
}
if (item.getChapters() != null) {
setChapters(item);