Introduce RssFeedViewModel

Furnishing the RssFeed function as a single activity with fragments for
Manage and Import.
This commit is contained in:
Daniel Lublin
2021-04-20 11:55:37 +02:00
parent 683af1ec3a
commit 73c7882cc0
58 changed files with 741 additions and 545 deletions

View File

@@ -10,7 +10,7 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class Feed {
public class Feed implements Comparable<Feed> {
private final String url;
private final Blog blog;
@@ -94,4 +94,13 @@ public class Feed {
return false;
}
@Override
public int compareTo(Feed o) {
if (this == o) return 0;
long aTime = getAdded(), bTime = o.getAdded();
if (aTime > bTime) return -1;
if (aTime < bTime) return 1;
return 0;
}
}

View File

@@ -1,6 +1,7 @@
package org.briarproject.briar.api.feed;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.Transaction;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.sync.ClientId;
@@ -23,7 +24,7 @@ public interface FeedManager {
/**
* Adds an RSS feed as a new dedicated blog.
*/
void addFeed(String url) throws DbException, IOException;
Feed addFeed(String url) throws DbException, IOException;
/**
* Removes an RSS feed.
@@ -35,4 +36,8 @@ public interface FeedManager {
*/
List<Feed> getFeeds() throws DbException;
/**
* Returns a list of all added RSS feeds
*/
List<Feed> getFeeds(Transaction txn) throws DbException;
}