Android Open Source - RabbitEars Feed






From Project

Back to project page RabbitEars.

License

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.

Java Source Code

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;
    }
}




Java Source Code List

com.fbs.rabbitears.ApplicationTest.java
com.fbs.rabbitears.Config.java
com.fbs.rabbitears.RabbitEars.java
com.fbs.rabbitears.activities.BaseActivity.java
com.fbs.rabbitears.activities.FeedLister.java
com.fbs.rabbitears.activities.ItemLister.java
com.fbs.rabbitears.activities.ItemStreamer.java
com.fbs.rabbitears.activities.ItemViewer.java
com.fbs.rabbitears.activities.Settings.java
com.fbs.rabbitears.adapters.FeedArrayAdapter.java
com.fbs.rabbitears.adapters.FeedItemArrayAdapter.java
com.fbs.rabbitears.contracts.feed.Author.java
com.fbs.rabbitears.contracts.feed.Content.java
com.fbs.rabbitears.contracts.feed.Entry.java
com.fbs.rabbitears.contracts.feed.Feed.java
com.fbs.rabbitears.contracts.feed.Link.java
com.fbs.rabbitears.contracts.rss.Category.java
com.fbs.rabbitears.contracts.rss.Channel.java
com.fbs.rabbitears.contracts.rss.Enclosure.java
com.fbs.rabbitears.contracts.rss.Guid.java
com.fbs.rabbitears.contracts.rss.Image.java
com.fbs.rabbitears.contracts.rss.Item.java
com.fbs.rabbitears.contracts.rss.Rss.java
com.fbs.rabbitears.events.Event.java
com.fbs.rabbitears.events.FeedDownloadEvent.java
com.fbs.rabbitears.events.ItemProcessEvent.java
com.fbs.rabbitears.fragments.AddFeedDialog.java
com.fbs.rabbitears.fragments.BaseDialogFragment.java
com.fbs.rabbitears.helpers.DeserializationHelper.java
com.fbs.rabbitears.helpers.FileHelper.java
com.fbs.rabbitears.helpers.ModelHelper.java
com.fbs.rabbitears.helpers.ViewHelper.java
com.fbs.rabbitears.models.FeedItem.java
com.fbs.rabbitears.models.Feed.java
com.fbs.rabbitears.models.ItemMedia.java
com.fbs.rabbitears.tasks.DownloadFeedImageTask.java
com.fbs.rabbitears.tasks.DownloadFeedTask.java
com.fbs.rabbitears.tasks.ProcessFeedItemsTask.java
com.fbs.rabbitears.utils.RssParser.java
com.fbs.rabbitears.utils.Size.java
com.fbs.rabbitears.views.MediaStreamer.java