Skip to content

Commit 0373a2a

Browse files
author
vishnu
committed
Fixed internal reddit links for /message/compose
1 parent 2c50079 commit 0373a2a

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snoohtmlparser/src/main/java/xyz/vishnum/snoohtmlparser/SnooParser.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ public void replaceHandler(String tag, TagNodeHandler handler) {
5959
*/
6060
public List<RedditBlock> getBlocks(String escapedHtml) {
6161
String unescapedHtml = Parser.unescapeEntities(escapedHtml, false);
62-
unescapedHtml = unescapedHtml.replace("href=\"/u/", "href=\"http://www.reddit.com/u/")
63-
.replace("href=\"/r/", "href=\"http://www.reddit.com/r/");
62+
unescapedHtml = unescapedHtml
63+
.replace("href=\"/u/", "href=\"http://www.reddit.com/u/")
64+
.replace("href=\"/r/", "href=\"http://www.reddit.com/r/")
65+
.replace("href=\"/message/", "href=\"http://www.reddit.com/message/");
6466
Document document = Jsoup.parseBodyFragment(unescapedHtml);
6567

6668
String buffer = "";

snoohtmlparser/src/main/java/xyz/vishnum/snoohtmlparser/SnooView.java

+3-16
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,10 @@
3737
public class SnooView extends LinearLayout {
3838
private static final String TAG = SnooView.class.getSimpleName();
3939
private static final LayoutParams HR_PARAMS;
40-
private static final LayoutParams TEXT_PARAMS_MIDDLE;
41-
private static final LayoutParams TEXT_PARAMS_TOP;
42-
private static final LayoutParams TEXT_PARAMS_BOTTOM;
4340

4441
static {
4542
HR_PARAMS = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 4 /*px*/);
4643
HR_PARAMS.setMargins(0, 32, 0, 32);
47-
48-
TEXT_PARAMS_TOP = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
49-
ViewGroup.LayoutParams.WRAP_CONTENT);
50-
TEXT_PARAMS_TOP.setMargins(0, 0, 0, 32);
51-
52-
TEXT_PARAMS_BOTTOM = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
53-
ViewGroup.LayoutParams.WRAP_CONTENT);
54-
TEXT_PARAMS_BOTTOM.setMargins(0, 32, 0, 0);
55-
56-
TEXT_PARAMS_MIDDLE = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
57-
ViewGroup.LayoutParams.WRAP_CONTENT);
58-
TEXT_PARAMS_MIDDLE.setMargins(0, 32, 0, 32);
5944
}
6045

6146
private OnUrlClickListener urlClickListener = null;
@@ -116,6 +101,7 @@ public void setBlocks(List<RedditBlock> blocks) {
116101
TextView codeView = new TextView(context);
117102
codeView.setText(((CodeBlock) block).getText());
118103
codeScrollView.addView(codeView);
104+
codeScrollView.setScrollbarFadingEnabled(false);
119105
addView(codeScrollView);
120106
break;
121107
case TABLE:
@@ -125,6 +111,7 @@ public void setBlocks(List<RedditBlock> blocks) {
125111
formatTable(tableBlock.getHeaderRow(), tableBlock.getBodyRows(),
126112
context);
127113
tableScrollView.addView(tableLayout);
114+
tableScrollView.setScrollbarFadingEnabled(false);
128115
addView(tableScrollView);
129116
break;
130117
}
@@ -191,7 +178,7 @@ private void handleUrlClick(String url) {
191178
try {
192179
context.startActivity(intent);
193180
} catch (ActivityNotFoundException e) {
194-
Log.w("ClickableSpan", "Activity was not found for intent, " + intent.toString());
181+
Log.e("ClickableSpan", "Activity was not found for intent, " + intent.toString());
195182
}
196183
}
197184
}

0 commit comments

Comments
 (0)