Store additional properties of RSS feed in metadata.

This commit is contained in:
akwizgran
2022-12-09 17:57:20 +00:00
parent 1a2f85f701
commit b920382e44
9 changed files with 146 additions and 55 deletions

View File

@@ -28,8 +28,7 @@ class RssFeedAdapter extends ListAdapter<Feed, RssFeedAdapter.FeedViewHolder> {
super(new DiffUtil.ItemCallback<Feed>() {
@Override
public boolean areItemsTheSame(Feed a, Feed b) {
return a.getUrl().equals(b.getUrl()) &&
a.getBlogId().equals(b.getBlogId()) &&
return a.getBlogId().equals(b.getBlogId()) &&
a.getAdded() == b.getAdded();
}
@@ -86,8 +85,8 @@ class RssFeedAdapter extends ListAdapter<Feed, RssFeedAdapter.FeedViewHolder> {
delete.setOnClickListener(v -> listener.onDeleteClick(item));
// Author
if (item.getRssAuthor() != null) {
author.setText(item.getRssAuthor());
if (item.getProperties().getAuthor() != null) {
author.setText(item.getProperties().getAuthor());
author.setVisibility(VISIBLE);
authorLabel.setVisibility(VISIBLE);
} else {
@@ -100,8 +99,8 @@ class RssFeedAdapter extends ListAdapter<Feed, RssFeedAdapter.FeedViewHolder> {
updated.setText(formatDate(ctx, item.getUpdated()));
// Description
if (item.getDescription() != null) {
description.setText(item.getDescription());
if (item.getProperties().getDescription() != null) {
description.setText(item.getProperties().getDescription());
description.setVisibility(VISIBLE);
} else {
description.setVisibility(GONE);

View File

@@ -168,7 +168,9 @@ class RssFeedViewModel extends DbViewModel {
List<Feed> list = getList(feeds);
if (list != null) {
for (Feed feed : list) {
if (url.equals(feed.getUrl())) {
// TODO: Fetch the feed and also match it against feeds that
// were imported from files?
if (url.equals(feed.getProperties().getUrl())) {
return true;
}
}