more images from cache
This commit is contained in:
@@ -56,7 +56,7 @@ public class JSONLoader implements Serializable {
|
||||
jsonStatus = jsonPost.getJSONObject("reblog");
|
||||
}
|
||||
jsonAccount = jsonStatus.getJSONObject("account");
|
||||
post.setAuthorAvatarUrl(jsonAccount.getString("avatar"));
|
||||
post.setAuthorAvatarUrl(buildCacheUrl(jsonAccount.getString("avatar")));
|
||||
post.setAuthorDisplayName(jsonAccount.getString("display_name"));
|
||||
post.setAuthorHandle(jsonAccount.getString("acct"));
|
||||
post.setAuthorUrl(jsonAccount.getString("url"));
|
||||
@@ -79,6 +79,7 @@ public class JSONLoader implements Serializable {
|
||||
final Object imageObject = jsonCard.get("image");
|
||||
if (imageObject != null && imageObject instanceof String) {
|
||||
medium.setMediumImage(jsonCard.getString("image"));
|
||||
medium.setMediumImage(buildCacheUrl(jsonCard.getString("image")));
|
||||
} else {
|
||||
final String defaultImage = contextUrl + medium.getMediumImage();
|
||||
medium.setMediumImage(defaultImage);
|
||||
@@ -94,12 +95,7 @@ public class JSONLoader implements Serializable {
|
||||
medium.setDescription(mediumJsonObject.getString("description"));
|
||||
}
|
||||
medium.setMediumUrl(mediumJsonObject.getString("preview_url"));
|
||||
final String imageUrl = mediumJsonObject.getString("url");
|
||||
if (imageUrl != null && imageUrl.startsWith("https://")) {
|
||||
medium.setMediumImage(contextUrl + "cache" + imageUrl.substring(7));
|
||||
} else {
|
||||
medium.setMediumImage(imageUrl);
|
||||
}
|
||||
medium.setMediumImage(buildCacheUrl(mediumJsonObject.getString("url")));
|
||||
post.addFediMedium(medium);
|
||||
}
|
||||
}
|
||||
@@ -115,8 +111,15 @@ public class JSONLoader implements Serializable {
|
||||
fediPage.setFollowing(jsonProfile.getInt("following_count"));
|
||||
fediPage.setPosts(jsonProfile.getInt("statuses_count"));
|
||||
fediPage.setUrl(jsonProfile.getString("url"));
|
||||
fediPage.setAvatarUrl(jsonProfile.getString("avatar"));
|
||||
fediPage.setHeaderUrl(jsonProfile.getString("header"));
|
||||
fediPage.setAvatarUrl(buildCacheUrl(jsonProfile.getString("avatar")));
|
||||
fediPage.setHeaderUrl(buildCacheUrl(jsonProfile.getString("header")));
|
||||
}
|
||||
|
||||
private String buildCacheUrl(final String url) {
|
||||
if (url != null && url.startsWith("https://")) {
|
||||
return contextUrl + "cache" + url.substring(7);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
private JSONObject loadJsonProfile() throws IOException, URISyntaxException {
|
||||
|
||||
Reference in New Issue
Block a user