From 36a7ed44630357080f8574546f21e9d5950e1f25 Mon Sep 17 00:00:00 2001 From: nopjmp Date: Tue, 27 May 2014 16:35:34 -0500 Subject: [PATCH] Added "(OP)" to the end of the quote link when its links to the OP --- .../java/org/floens/chan/core/model/Post.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java index 2cf1e039..79809865 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java +++ b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java @@ -215,13 +215,8 @@ public class Post { } else if (nodeName.equals("a")) { 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; - 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) { try { // Get post id @@ -229,11 +224,22 @@ public class Post { if (splitted.length == 2) { int id = Integer.parseInt(splitted[1]); repliesTo.add(id); + + // Append OP when its a reply to OP + if(id == resto) { + anchor.appendText(" (OP)"); + } } } 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); } else if (nodeName.equals("s")) { Element spoiler = (Element) node;