Back to project page RabbitEars.
The source code is released under:
MIT License
If you think the Android project RabbitEars listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.fbs.rabbitears.contracts.feed; /*w ww .j a v a 2s .c o m*/ import com.fbs.rabbitears.contracts.rss.Channel; import com.fbs.rabbitears.contracts.rss.Enclosure; import com.fbs.rabbitears.contracts.rss.Guid; import com.fbs.rabbitears.contracts.rss.Image; import com.fbs.rabbitears.contracts.rss.Item; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Feed Serialization Contract */ public class Feed { public String title; public String subtitle; public String icon; public Link link; public Date updated; @SerializedName("entry") public List<Entry> entries; public boolean isValid() { return title != null && entries != null; } public Channel toChannel() { Channel channel = new Channel(); channel.title = title; channel.description = subtitle; channel.image = new Image(); channel.image.url = icon; channel.link = link.href; channel.lastBuildDate = updated; channel.items = new ArrayList<Item>(); for (Entry entry : entries) { Item item = new Item(); item.title = entry.title; item.guid = new Guid(); item.guid.value = entry.id; item.updated = entry.updated; item.pubDate = entry.published; if (entry.hasContent()) { item.description = entry.content.value; } for (Link link : entry.links) { if (link.isEnclosure()) { item.enclosure = new Enclosure(); item.enclosure.length = "-1"; item.enclosure.link = link.href; item.enclosure.mime = link.type; } else { item.link = link.href; } } channel.items.add(item); } return channel; } }