Merge pull request #9 from nopjmp/master

Added "(OP)" to the end of the quote link when its links to the OP
captchafix
Sietsem 11 years ago
commit f5fb2f458c
  1. 18
      Clover/app/src/main/java/org/floens/chan/core/model/Post.java

@ -215,13 +215,8 @@ public class Post {
} else if (nodeName.equals("a")) { } else if (nodeName.equals("a")) {
Element anchor = (Element) node; Element anchor = (Element) node;
SpannableString link = new SpannableString(anchor.text()); // is this a link or a quote
Type t = anchor.text().contains("://") ? Type.LINK : Type.QUOTE; Type t = anchor.text().contains("://") ? Type.LINK : Type.QUOTE;
PostLinkable pl = new PostLinkable(this, anchor.text(), anchor.attr("href"), t);
link.setSpan(pl, 0, link.length(), 0);
linkables.add(pl);
if (t == Type.QUOTE) { if (t == Type.QUOTE) {
try { try {
// Get post id // Get post id
@ -229,11 +224,22 @@ public class Post {
if (splitted.length == 2) { if (splitted.length == 2) {
int id = Integer.parseInt(splitted[1]); int id = Integer.parseInt(splitted[1]);
repliesTo.add(id); repliesTo.add(id);
// Append OP when its a reply to OP
if(id == resto) {
anchor.appendText(" (OP)");
}
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} }
SpannableString link = new SpannableString(anchor.text());
PostLinkable pl = new PostLinkable(this, anchor.text(), anchor.attr("href"), t);
link.setSpan(pl, 0, link.length(), 0);
linkables.add(pl);
total = TextUtils.concat(total, link); total = TextUtils.concat(total, link);
} else if (nodeName.equals("s")) { } else if (nodeName.equals("s")) {
Element spoiler = (Element) node; Element spoiler = (Element) node;

Loading…
Cancel
Save