mirror of https://github.com/readrops/Readrops.git
Fixing atom format very annoying urls problem, by setting them manually just after parsing
This commit is contained in:
parent
8fcd5fc3ad
commit
b7ac444be0
|
@ -103,6 +103,6 @@ public class ItemActivity extends AppCompatActivity {
|
|||
readTimeLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
webView.setItem(itemWithFeed);
|
||||
webView.setItem(itemWithFeed, Utils.getDeviceWidth(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public class Feed {
|
|||
feed.setName(atomFeed.getTitle());
|
||||
feed.setDescription(atomFeed.getSubtitle());
|
||||
feed.setUrl(atomFeed.getUrl());
|
||||
feed.setSiteUrl(atomFeed.getWebSiteUrl());
|
||||
feed.setSiteUrl(atomFeed.getWebsiteUrl());
|
||||
feed.setDescription(atomFeed.getSubtitle());
|
||||
feed.setLastUpdated(atomFeed.getUpdated());
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class RSSNetwork {
|
|||
if (type == RSSType.RSS_UNKNOWN) {
|
||||
if (Pattern.compile(RSS_2_REGEX).matcher(xml).find())
|
||||
type = RSSType.RSS_2;
|
||||
else if (xml.contains("<feed xmlns=\"http://www.w3.org/2005/Atom\">"))
|
||||
else if (xml.contains("<feed xmlns=\"http://www.w3.org/2005/Atom\""))
|
||||
type = RSSType.RSS_ATOM;
|
||||
else {
|
||||
callback.onSyncFailure(new Exception("Unknown xml format"));
|
||||
|
@ -100,6 +100,7 @@ public class RSSNetwork {
|
|||
String etag = response.header(LibUtils.ETAG_HEADER);
|
||||
String lastModified = response.header(LibUtils.LAST_MODIFIED_HEADER);
|
||||
|
||||
|
||||
switch (type) {
|
||||
case RSS_2:
|
||||
RSSFeed rssFeed = serializer.read(RSSFeed.class, xml);
|
||||
|
@ -112,6 +113,8 @@ public class RSSNetwork {
|
|||
break;
|
||||
case RSS_ATOM:
|
||||
ATOMFeed atomFeed = serializer.read(ATOMFeed.class, xml);
|
||||
atomFeed.setWebsiteUrl(response.request().url().scheme() + "://" + response.request().url().host());
|
||||
atomFeed.setUrl(response.request().url().toString());
|
||||
atomFeed.setEtag(etag);
|
||||
atomFeed.setLastModified(etag);
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ public class ATOMFeed extends AFeed {
|
|||
@ElementList(name = "link", inline = true, required = false)
|
||||
private List<ATOMLink> links;
|
||||
|
||||
private String url;
|
||||
|
||||
private String websiteUrl;
|
||||
|
||||
@Element(required = false)
|
||||
private String id;
|
||||
|
||||
|
@ -88,7 +92,23 @@ public class ATOMFeed extends AFeed {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getWebSiteUrl() {
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getWebsiteUrl() {
|
||||
return websiteUrl;
|
||||
}
|
||||
|
||||
public void setWebsiteUrl(String websiteUrl) {
|
||||
this.websiteUrl = websiteUrl;
|
||||
}
|
||||
|
||||
/*public String getWebSiteUrl() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -104,5 +124,5 @@ public class ATOMFeed extends AFeed {
|
|||
}
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue