GithubHelp home page GithubHelp logo

sufficientlysecure / html-textview Goto Github PK

View Code? Open in Web Editor NEW
2.5K 2.5K 495.0 394 KB

TextView to display simple HTML

License: Apache License 2.0

Java 94.49% HTML 5.51%
android android-library textview

html-textview's People

Contributors

andhie avatar danielmartinus avatar danielpassos avatar derekcsm avatar devgary avatar dhenry avatar dschuermann avatar elliottj-accolade avatar feeeei avatar foobar2016 avatar ivannarino avatar kamiox avatar kimkha avatar krzysztof-drobek avatar matthiaswenz avatar ofalvai avatar seato avatar shikherverma avatar sunny52525 avatar superpichu avatar usernotnull avatar xiandanin avatar yuanwenhai avatar zhenmingma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html-textview's Issues

jCenter or Maven

Would it be possible to upload your great library to jCenter or Maven?

Conflicting with OnItemLongClick in listview

Hello!

Just ran across a weird issue that took me hours to figure out. I had a listview holding comments (ImageView for the user picture, textview for user name and html-textview for the comment body).

I implemented long click on the listview to be able to select a comment and delete it from action mode.

But when I had a row selected and I scrolled the listview, OnItemLongClick was trigger randomly like I had LongClick a row.

Turns out when I switch from html-textview to the standard textview, the issue stopped and everything worked as expected.

If you need me to setup a quick sample project to reproduce the issue, I could do that.

Thanks.

Marquee Issue

Is there any way to marquee the text in textview ?

Content not shown, only image

data like this:
<div>-2011的相反数是 <table name="optionsTable" cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="25%">A.2011</td> <td width="25%">B.-2011</td> <td width="25%">C.<img src="http://192.168.0.126:6001/p/main/download_file/KdjyFileSystem1_11cbaeae-a953-41f6-aae7-8d73e3b104e2.png" style="vertical-align:middle;" /></td> <td width="25%">D.-<img src="http://192.168.0.126:6001/p/main/download_file/KdjyFileSystem1_11cbaeae-a953-41f6-aae7-8d73e3b104e2.png" style="vertical-align:middle;" /></td> </tr> </table> </div>
I used like this:
text_title.setHtml(R.raw.example, new HtmlHttpImageGetter(text_title));
Please help me!

Nested list bullet points overlap text

This is reproducible only on Android 6.0. I have seen this on Genymotion and Nexus 5X.
It appears only when list is nested in another one:

  • Coffee
  • Tea
    • Black tea
    • Green tea
  • Milk

It seems that spaces between bullet point and text are ignored.
Poor workaround for this is to add \t between the bullet point and a text.

Image overlapping text with right-to-left

I start using your nice library. but i found an issue with images where the first image is shown very small and in case it is in the end of paragraph it overlaps the text.
please see this image:
screenshot_2015-12-31-00-49-43

and this is the html for that text:

 "content": "<img src=\"http://www.alyemenialyoum.com/user_images/news/30-12-15-878636455.jpg\" alt=\"\"/>\n                    \n\n \n                    <p>سخرت المقاومة الشعبية بمحافظة تعز ، من الموالين لمليشيات الحوثي وصالح ، بعد انتشار مقطع فيديو لأحد عناصرهم يطلب من نجل المخلوع صالح  كبسولة عطر خاص .<p>وصنعت المقاومة في تعز مجموعة عطور مختلفة عليها شعارات حماسية ، للسخرية من الموالين للحوثي وصالح ، والاستفادة مادياً منها .<p>الجدير بالذكر ان ناشطون على مواقع التواصل الاجتماعية ، أطلقوا حملة سخرية من الموالين لمليشيات الحوثي وصالح ، بسبب الروائح القذرة التي تفوح منهم ، والاشكال التي يظهرون بها ، ومطالبتهم بفضلات زعيمهم عطراً لهم كما اسموها في خطوة تدل على قذرتهم والفئة التي ينتمون لها .</p>\r\n<p><img src=\"http://alyemenialyoum.com/user_images/news/30-12-15-505172948.jpg\"/></p>",

Crash with <ol> or <ul> (PARAGRAPH span must end at paragraph boundary)

My app crashes if I set an Html String containing <ol> or <ul> tags.

This String causes a crash:
<ul><li>Test</li></ul><div>Hello</div>

My logcat says:
FATAL EXCEPTION: main Process: com.bluemango.keynote, PID: 14353 java.lang.RuntimeException: PARAGRAPH span must end at paragraph boundary (6 follows ) at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:95) at android.text.SpannableStringInternal.<init>(SpannableStringInternal.java:52) at android.text.SpannedString.<init>(SpannedString.java:30)

UPDATE:
I notice that it crashes only if I set android:singleLine="true"

<marquee> tag not working

i am trying to implement marquee feature but unfortunately not working .
This is basic example of marquee

Default marquee in android textview has 1200 milisec marque delay but I need to change it to 0 msec ,for that I have to use html marquee tag but it is not working ...

Please help...

Trim trailing whitespaces

Hi,

There is an issue with ending

tag with Html.fromHtml that I fixed by using the accepted method of this stackoverflow topic

The problem is that I can't do it anymore when i use your lib. Would you be kind enough to integrate this bug fix ?

Thanks.

PARAGRAPH span must start at paragraph boundary (no linebreak in li tags possible)

java.lang.RuntimeException: PARAGRAPH span must start at paragraph boundary
            at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:604)
            at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592)
            at android.text.HtmlToSpannedConverter.convert(Html.java:461)
            at android.text.Html.fromHtml(Html.java:138)
            at org.sufficientlysecure.htmltextview.HtmlTextView.setHtmlFromString(HtmlTextView.java:82)

YouTube support

Currently, YouTube and other online video become famous, TextView should support it.

My recommend:

  • Display a thumbnail image with Play button overlapping.
  • When click on thumbnail image, a video player will run (we don't need to implement video player, just use default)

Use without imageGetter.

Is there is any way to apply html data only without image Getter? there will be no image tag in html data.
In some cases we need only html data to be render on textView not images.

Supporting HTML table tag

It would be nice to have some sort of support for the HTML table tag.

Here's a solution which grabs the HTML and makes it available to the app to do whatever it would like with it (like passing it to a WebView): #33

Nested UL tags not working

For some reason nested UL tags aren't rendering correctly. When I use a WebView, they render perfectly. Now, I've tried using WebViews but the performance has been terrible and I've even encountered app crashes.

Here's a sample of my HTML.

<ul>
    <li>Blah blah blah blah blah</li>
</ul>
<ul>
    <ul>
        <li>Blah blah blah blah blah</li>
    </ul>
</ul>
<ul>
    <ul>
        <li>Blah blah blah blah blah</li>
    </ul>
</ul>
<ul>
    <ul>
        <li>Blah blah blah blah blah</sup>
        </li>
    </ul>
</ul>

And what it should look like:

  • Blah blah blah blah blah
    • Blah blah blah blah blah
    • Blah blah blah blah blah
    • Blah blah blah blah blah

Except I'm getting this:

  • No Compromise, Fully Capable
  • Seating for up to 7 passengers
  • Significantly updated exterior and interior
  • New Platinum trim level1

Is there anything that I can do to get this working properly with your library ?

EDIT: Fixed formatting.

html styling/images not added when htmltextview added to layout programmatically

HtmlTextView intervalTv= new HtmlTextView(mContext);
intervalTv.setTextColor(Color.parseColor("#000000"));
intervalTv.setGravity(Gravity.CENTER_HORIZONTAL);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( mSeekBar.getLayoutParams().width/_choices.size(), ViewGroup.LayoutParams.WRAP_CONTENT);
intervalTv.setLayoutParams(params);
intervalTv.setHtml(choice.Label, new HtmlHttpImageGetter(intervalTv));
(linearlayout).addView(intervalTv);

where choice.Label = "Statement <span style="text-decoration: underline;">equally describes Category at Family Dollar and Dollar General"
not seeing text decoration in textview

or when choice.Label contains img tag, not seeing image

can't load remote image

I use version 1.8 in gradle
compile 'org.sufficientlysecure:html-textview:1.8'

and add the following codes in android

        HtmlTextView mTVNewsContent = (HtmlTextView) findViewById(R.id.htNewsContent);
        String newsDetailContent = "<h2>Hello wold</h2><ul><li>cats</li><li>dogs</li></ul><img src=\"http://120.26.39.36/uploads/news/tmp/4495039226559854.jpg\"/>";
        mTVNewsContent.setHtml(newsDetailContent, new HtmlRemoteImageGetter(mTVNewsContent));

But, I can't get the image in app.Any helps will be appreciated.

I meet the exception when I use this library

I meet the following exception when I use this library

Pending exception java.lang.IllegalStateException: Unable to create layer for HtmlTextView
   at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
   at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:323)
   at void android.os.Looper.loop() (Looper.java:135)
   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5417)
   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:726)
   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:616)

I doubt that it may be caused by hardwareAccelerated, when I set 'android:hardwareAccelerated="false"' in AndroidManifest.xml, the exception don't happen,But it led to some effect cannot achieve.
How can I fix this exception?

why aren't other image getters allowed ?

if (imageGetter instanceof LocalImageGetter) {
            htmlImageGetter = new HtmlLocalImageGetter(getContext());
        } else if (imageGetter instanceof RemoteImageGetter) {
            htmlImageGetter = new HtmlRemoteImageGetter(this,
                    ((RemoteImageGetter) imageGetter).baseUrl);
        } else {
            Log.e(TAG, "Wrong imageGetter!");
            return;
        }

I want to use other fetching libaries while loading images. For example this

文字大小

这个能设置同一个Textview中不同字的大小吗

Support for databinding

I would like to use the databinding with html-textview component. Is it worth adding as a feature? Also, if you can provide me pointers of how and where to put in the code I can work on it.

Click event on link?

Can I catch an event when clicking a link in HTML? Currently, it's open the web browser, I want to handle some link schema in HTML. Please help!

Custom TagHandler

Hi!

If a tag is not supported by your library, is there any way to handle it?

Thanks!

Denis

how to apply css?

Hi
I am working on an Epub viewer
I want to know is it possible to apply css into your HtmlTextView?
thanks

Images gravity

Can i set or change the way how images being loaded, or give them size or gravity (match_parent or wrap_content. gravity: center)?

Images are too big

When the HTML code is for PC , the size of imge from url is so big that would cause Out Of Memory . How can I let the device load small images without optimising HTML code for mobile ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.