From 08c963d1e2167e16918ad2628268e2c3c3240ab4 Mon Sep 17 00:00:00 2001 From: hzwangchenyan Date: Tue, 6 Jun 2017 16:47:12 +0800 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index deaabbb..9b90133 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转 - `` - `

`, `

`, `

`, `

`, `

`, `
` - `` -- `` +- `< img src="...">` ### Extended support by HtmlText @@ -43,7 +43,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转 - `` - `
`[HTML contains two newline, there is one] - ``[extend support size] -- ``[extend support width, height] +- `< img src="..." width="..." height="...">`[extend support width, height] ## Sample @@ -58,7 +58,7 @@ HtmlText.from(sample) @Override public void loadImage(String url, final Callback callback) { // Glide sample, you can also use other image loader - Glide.with(MainActivity.this) + Glide.with(context) .load(url) .asBitmap() .into(new SimpleTarget() { @@ -77,12 +77,12 @@ HtmlText.from(sample) @Override public Drawable getDefaultDrawable() { - return ContextCompat.getDrawable(MainActivity.this, R.drawable.image_placeholder_loading); + return ContextCompat.getDrawable(context, R.drawable.image_placeholder_loading); } @Override public Drawable getErrorDrawable() { - return ContextCompat.getDrawable(MainActivity.this, R.drawable.image_placeholder_fail); + return ContextCompat.getDrawable(context, R.drawable.image_placeholder_fail); } @Override @@ -97,18 +97,22 @@ HtmlText.from(sample) }) .setOnTagClickListener(new OnTagClickListener() { @Override - public void onImageClick(List imageUrlList, int position) { + public void onImageClick(Context context, List imageUrlList, int position) { // image click } @Override - public void onLinkClick(String url) { + public void onLinkClick(Context context, String url) { // link click } }) .into(textView); ``` +## Download + +Github: [HtmlText](https://github.com/wangchenyan/HtmlText) + ## Thanks - [html-textview](https://github.com/SufficientlySecure/html-textview)