Skip to content

Commit b0e2663

Browse files
committed
Fixed access problem and removed context from HtmlTagHandler.
1 parent a938e1e commit b0e2663

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

markdowntextview/src/main/java/com/tpb/mdtext/HtmlTagHandler.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package com.tpb.mdtext;
2121

22-
import android.content.Context;
2322
import android.graphics.Color;
2423
import android.support.annotation.NonNull;
2524
import android.support.annotation.Nullable;
@@ -42,7 +41,6 @@
4241

4342
import com.tpb.mdtext.handlers.CodeClickHandler;
4443
import com.tpb.mdtext.handlers.LinkClickHandler;
45-
import com.tpb.mdtext.views.MarkdownTextView;
4644
import com.tpb.mdtext.views.spans.CleanURLSpan;
4745
import com.tpb.mdtext.views.spans.ClickableTableSpan;
4846
import com.tpb.mdtext.views.spans.CodeSpan;
@@ -52,6 +50,7 @@
5250
import com.tpb.mdtext.views.spans.NumberSpan;
5351
import com.tpb.mdtext.views.spans.QuoteSpan;
5452
import com.tpb.mdtext.views.spans.RoundedBackgroundEndSpan;
53+
5554
import org.xml.sax.XMLReader;
5655

5756
import java.lang.reflect.Field;
@@ -131,10 +130,8 @@ public String overrideTags(@Nullable String html) {
131130
private final TextPaint mTextPaint;
132131
private LinkClickHandler mLinkHandler;
133132
private CodeClickHandler mCodeHandler;
134-
private Context mContext;
135133

136134
public HtmlTagHandler(TextView tv, @Nullable LinkClickHandler linkHandler, @Nullable CodeClickHandler codeHandler) {
137-
mContext = tv.getContext();
138135
mTextPaint = tv.getPaint();
139136
mLinkHandler = linkHandler;
140137
mCodeHandler = codeHandler;
@@ -145,9 +142,6 @@ public HtmlTagHandler(TextView tv, @Nullable LinkClickHandler linkHandler, @Null
145142
public void handleTag(final boolean opening, final String tag, Editable output, final XMLReader xmlReader) {
146143
if(opening) {
147144
// opening tag
148-
if(MarkdownTextView.DEBUG) {
149-
Log.d(MarkdownTextView.TAG, "opening, output: " + output.toString());
150-
}
151145

152146
if(tag.equalsIgnoreCase(UNORDERED_LIST_TAG)) {
153147
lists.push(
@@ -236,9 +230,6 @@ public void handleTag(final boolean opening, final String tag, Editable output,
236230
}
237231
} else {
238232
// closing tag
239-
if(MarkdownTextView.DEBUG) {
240-
Log.d(MarkdownTextView.TAG, "closing, output: " + output.toString());
241-
}
242233

243234
if(tag.equalsIgnoreCase(UNORDERED_LIST_TAG)) {
244235
lists.pop();
@@ -544,9 +535,6 @@ private void storeTableTags(boolean opening, String tag) {
544535
private void start(Editable output, Object mark) {
545536
int len = output.length();
546537
output.setSpan(mark, len, len, Spannable.SPAN_MARK_MARK);
547-
if(MarkdownTextView.DEBUG) {
548-
Log.d(MarkdownTextView.TAG, "len: " + len);
549-
}
550538
}
551539

552540
/**
@@ -577,11 +565,6 @@ private void end(Editable output, Class kind, boolean paragraphStyle, Object...
577565
for(Object replace : replaces) {
578566
output.setSpan(replace, where, thisLen, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
579567
}
580-
581-
if(MarkdownTextView.DEBUG) {
582-
Log.d(MarkdownTextView.TAG, "where: " + where);
583-
Log.d(MarkdownTextView.TAG, "thisLen: " + thisLen);
584-
}
585568
}
586569
}
587570

markdowntextview/src/main/java/com/tpb/mdtext/URLPattern.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public class URLPattern {
267267
*
268268
* @hide
269269
*/
270-
private static final Pattern AUTOLINK_WEB_URL = Pattern.compile(
270+
static final Pattern AUTOLINK_WEB_URL = Pattern.compile(
271271
"(" + WEB_URL_WITH_PROTOCOL + "|" + WEB_URL_WITHOUT_PROTOCOL + ")($|\\s)");
272272

273273
/**

0 commit comments

Comments
 (0)