Search in sources :

Example 1 with Feeds

use of email.schaal.ocreader.api.json.Feeds in project ocreader by schaal.

the class APIv2 method createFeed.

@Override
public void createFeed(final Realm realm, String url, long folderId, APICallback<Void, Throwable> apiCallback) {
    final Feed feed = new Feed();
    feed.setUrl(url);
    feed.setFolderId(folderId);
    api.createFeed(feed).enqueue(new BaseRetrofitCallback<Feeds>(apiCallback) {

        @Override
        protected void onResponseReal(final Response<Feeds> response) {
            final Feeds feeds = response.body();
            if (feeds != null) {
                // Set unreadCount to 0, items have not been fetched yet for this feed
                Feed feed = feeds.getFeeds().get(0);
                feed.setUnreadCount(0);
                Queries.insert(realm, feed);
            }
        }
    });
}
Also used : Feeds(email.schaal.ocreader.api.json.Feeds) Feed(email.schaal.ocreader.database.model.Feed)

Aggregations

Feeds (email.schaal.ocreader.api.json.Feeds)1 Feed (email.schaal.ocreader.database.model.Feed)1