Created
July 10, 2015 03:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class URLSpanUtil extends URLSpan { | |
public URLSpanUtil(String url) { | |
super(url); | |
} | |
@Override | |
public void updateDrawState(TextPaint ds) { | |
ds.setColor(UtilApplication.ctx.getResources().getColor(R.color.underline_color)); | |
ds.setUnderlineText(false); | |
} | |
@Override | |
public void onClick(View widget) { | |
// super.onClick(widget); | |
Context context = widget.getContext(); | |
String url = getURL(); | |
if (StrUtil.notEmptyOrNull(url)) { | |
//这里简单判定url | |
if (url.startsWith("http") || url.startsWith("https")) { | |
//跳转到自己的webview处理 | |
Intent intent = new Intent(context, WebViewActivity.class); | |
context.startActivity(intent); | |
}else { | |
super.onClick(widget); | |
} | |
}else { | |
super.onClick(widget); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment