diff options
Diffstat (limited to 'src/de/danoeh/antennapod/feed/FeedItem.java')
-rw-r--r-- | src/de/danoeh/antennapod/feed/FeedItem.java | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/de/danoeh/antennapod/feed/FeedItem.java b/src/de/danoeh/antennapod/feed/FeedItem.java index 54682397e..a80460ece 100644 --- a/src/de/danoeh/antennapod/feed/FeedItem.java +++ b/src/de/danoeh/antennapod/feed/FeedItem.java @@ -48,6 +48,19 @@ public class FeedItem extends FeedComponent implements this.read = true; } + /** + * This constructor should be used for creating test objects. + * */ + public FeedItem(long id, String title, String itemIdentifier, String link, Date pubDate, boolean read, Feed feed) { + this.id = id; + this.title = title; + this.itemIdentifier = itemIdentifier; + this.link = link; + this.pubDate = (pubDate != null) ? (Date) pubDate.clone() : null; + this.read = read; + this.feed = feed; + } + public void updateFromOther(FeedItem other) { super.updateFromOther(other); if (other.title != null) { @@ -123,19 +136,35 @@ public class FeedItem extends FeedComponent implements } public Date getPubDate() { - return pubDate; + if (pubDate != null) { + return (Date) pubDate.clone(); + } else { + return null; + } } public void setPubDate(Date pubDate) { - this.pubDate = pubDate; + if (pubDate != null) { + this.pubDate = (Date) pubDate.clone(); + } else { + this.pubDate = null; + } } public FeedMedia getMedia() { return media; } + /** + * Sets the media object of this FeedItem. If the given + * FeedMedia object is not null, it's 'item'-attribute value + * will also be set to this item. + * */ public void setMedia(FeedMedia media) { this.media = media; + if (media != null && media.getItem() != this) { + media.setItem(this); + } } public Feed getFeed() { |