Troll flags support

Closes #318
multisite^2
Floens 8 years ago
parent 4ff2923583
commit 6724905b05
  1. 4
      Clover/app/src/main/java/org/floens/chan/chan/ChanUrls.java
  2. 8
      Clover/app/src/main/java/org/floens/chan/core/model/Post.java
  3. 3
      Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java
  4. 2
      Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java

@ -58,6 +58,10 @@ public class ChanUrls {
return scheme() + "://s.4cdn.org/image/country/" + countryCode.toLowerCase(Locale.ENGLISH) + ".gif";
}
public static String getCountryTrollFlagUrl(String trollCode) {
return scheme() + "://s.4cdn.org/image/country/troll/" + trollCode.toLowerCase(Locale.ENGLISH) + ".gif";
}
public static String getBoardsUrl() {
return scheme() + "://a.4cdn.org/boards.json";
}

@ -87,6 +87,8 @@ public class Post {
public String countryName = "";
public String trollCountry = "";
public long time = -1;
public long fileSize;
@ -180,9 +182,13 @@ public class Post {
image = new PostImage(String.valueOf(tim), thumbnailUrl, imageUrl, filename, ext, imageWidth, imageHeight, spoilerImage, fileSize);
}
if (!TextUtils.isEmpty(country)) {
if (!TextUtils.isEmpty(countryName)) {
if (!TextUtils.isEmpty(trollCountry)) {
countryUrl = ChanUrls.getCountryTrollFlagUrl(trollCountry);
} else {
countryUrl = ChanUrls.getCountryFlagUrl(country);
}
}
ChanParser.getInstance().parse(this);

@ -400,6 +400,9 @@ public class ChanReaderRequest extends JsonReaderRequest<ChanReaderRequest.ChanR
case "country_name":
post.countryName = reader.nextString();
break;
case "troll_country":
post.trollCountry = reader.nextString();
break;
case "id":
post.id = reader.nextString();
break;

@ -399,7 +399,7 @@ public class PostCell extends LinearLayout implements PostCellInterface {
icons.set(PostIcons.DELETED, post.deleted.get());
icons.set(PostIcons.ARCHIVED, post.archived);
if (!isEmpty(post.country)) {
if (!isEmpty(post.countryUrl)) {
icons.set(PostIcons.COUNTRY, true);
icons.showCountry(post, theme, countrySizePx);
} else {

Loading…
Cancel
Save