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. 10
      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"; 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() { public static String getBoardsUrl() {
return scheme() + "://a.4cdn.org/boards.json"; return scheme() + "://a.4cdn.org/boards.json";
} }

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

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

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

Loading…
Cancel
Save