diff --git a/app/src/main/java/com/readrops/app/database/entities/Item.java b/app/src/main/java/com/readrops/app/database/entities/Item.java index 6e01c70a..82e643b3 100644 --- a/app/src/main/java/com/readrops/app/database/entities/Item.java +++ b/app/src/main/java/com/readrops/app/database/entities/Item.java @@ -167,8 +167,7 @@ public class Item { dbItem.setTitle(item.getTitle()); dbItem.setPubDate(DateUtils.stringToDateTime(item.getUpdated(), DateUtils.ATOM_JSON_DATE_FORMAT)); - - dbItem.setLink(item.getLink().getHref()); + dbItem.setLink(item.getUrl()); dbItem.setFeedId(feed.getId()); diff --git a/app/src/main/res/layout/add_feed_layout.xml b/app/src/main/res/layout/add_feed_layout.xml index 223e9f55..0ad0c2d9 100644 --- a/app/src/main/res/layout/add_feed_layout.xml +++ b/app/src/main/res/layout/add_feed_layout.xml @@ -22,7 +22,7 @@ android:id="@+id/textInputLayout" android:layout_width="280dp" android:layout_height="wrap_content" - android:layout_marginTop="6dp" + android:layout_marginTop="12dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/add_feed_title"> @@ -42,6 +42,7 @@ android:layout_height="wrap_content" android:text="@string/add_feed_validate" app:layout_constraintEnd_toEndOf="parent" + android:textAlignment="center" app:layout_constraintTop_toBottomOf="@+id/textInputLayout" /> ")) type = RSSType.RSS_ATOM; diff --git a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/atom/ATOMEntry.java b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/atom/ATOMEntry.java index cba712cd..8cc15252 100644 --- a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/atom/ATOMEntry.java +++ b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/atom/ATOMEntry.java @@ -4,16 +4,19 @@ import com.readrops.readropslibrary.localfeed.AItem; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; +import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; +import java.util.List; + @Root(name = "entry", strict = false) public class ATOMEntry extends AItem { @Element(required = false) private String title; - @Element(required = false) - private ATOMLink link; + @ElementList(name = "link", inline = true, required = false) + private List links; @Element(required = false) private String updated; @@ -38,12 +41,12 @@ public class ATOMEntry extends AItem { this.title = title; } - public ATOMLink getLink() { - return link; + public List getLinks() { + return links; } - public void setLink(ATOMLink link) { - this.link = link; + public void setLinks(List links) { + this.links = links; } public String getUpdated() { @@ -85,4 +88,21 @@ public class ATOMEntry extends AItem { public void setContentType(String contentType) { this.contentType = contentType; } + + public String getUrl() { + if (links.size() > 0) { + if (links.get(0).getRel() == null) + return links.get(0).getHref(); + else { + if (links.size() > 1) { + if (links.get(1).getRel() == null) + return links.get(1).getHref(); + else + return null; + } else + return null; + } + } else + return null; + } }