Set image owner when parsing feed
This commit is contained in:
parent
2cd504b9d0
commit
b5066d02b4
@ -13,10 +13,11 @@ public class FeedImage extends FeedFile implements PicassoImageResource {
|
|||||||
protected String title;
|
protected String title;
|
||||||
protected FeedComponent owner;
|
protected FeedComponent owner;
|
||||||
|
|
||||||
public FeedImage(String download_url, String title) {
|
public FeedImage(FeedComponent owner, String download_url, String title) {
|
||||||
super(null, download_url, false);
|
super(null, download_url, false);
|
||||||
this.download_url = download_url;
|
this.download_url = download_url;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FeedImage(long id, String title, String file_url,
|
public FeedImage(long id, String title, String file_url,
|
||||||
@ -26,6 +27,10 @@ public class FeedImage extends FeedFile implements PicassoImageResource {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FeedImage() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHumanReadableIdentifier() {
|
public String getHumanReadableIdentifier() {
|
||||||
if (owner != null && owner.getHumanReadableIdentifier() != null) {
|
if (owner != null && owner.getHumanReadableIdentifier() != null) {
|
||||||
@ -40,10 +45,6 @@ public class FeedImage extends FeedFile implements PicassoImageResource {
|
|||||||
return FEEDFILETYPE_FEEDIMAGE;
|
return FEEDFILETYPE_FEEDIMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FeedImage() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,13 @@ public class NSITunes extends Namespace {
|
|||||||
if (state.getCurrentItem() != null) {
|
if (state.getCurrentItem() != null) {
|
||||||
// this is an items image
|
// this is an items image
|
||||||
image.setTitle(state.getCurrentItem().getTitle()+IMAGE_TITLE);
|
image.setTitle(state.getCurrentItem().getTitle()+IMAGE_TITLE);
|
||||||
|
image.setOwner(state.getCurrentItem());
|
||||||
state.getCurrentItem().setImage(image);
|
state.getCurrentItem().setImage(image);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// this is the feed image
|
// this is the feed image
|
||||||
if (state.getFeed().getImage() == null) {
|
if (state.getFeed().getImage() == null) {
|
||||||
|
image.setOwner(state.getFeed());
|
||||||
state.getFeed().setImage(image);
|
state.getFeed().setImage(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ public class NSRSS20 extends Namespace {
|
|||||||
String parent = state.getTagstack().peek().getName();
|
String parent = state.getTagstack().peek().getName();
|
||||||
if (parent.equals(CHANNEL)) {
|
if (parent.equals(CHANNEL)) {
|
||||||
state.getFeed().setImage(new FeedImage());
|
state.getFeed().setImage(new FeedImage());
|
||||||
|
state.getFeed().getImage().setOwner(state.getFeed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ public class NSAtom extends Namespace {
|
|||||||
SyndDateUtils.parseRFC3339Date(content));
|
SyndDateUtils.parseRFC3339Date(content));
|
||||||
}
|
}
|
||||||
} else if (top.equals(IMAGE)) {
|
} else if (top.equals(IMAGE)) {
|
||||||
state.getFeed().setImage(new FeedImage(content, null));
|
state.getFeed().setImage(new FeedImage(state.getFeed(), content, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user