yydcdut / RxMarkdown

:fax:Markdown for Android, supports TextView && EditText (Live Preview), supports code high light.
749 stars 93 forks source link

URLSpans don't work properly #32

Closed cesards closed 7 years ago

cesards commented 7 years ago

If we got:

This is another [link](http://deathstar-qa.herokuapp.com/reporting) please

It's not printing the url span properly, it just prints the text.

I've checked the code, and also I've been retrieving the spans, and it seems the span is there URLSpan[] spans = stringBuilder.getSpans(0, charSequence.length(), URLSpan.class); but it's not being drawn properly:

screenshot_20170403-163147

yydcdut commented 7 years ago

Did you set

setLinkColor(Color.BLUE)
setLinkUnderline(false)

in RxMDConfiguration.Builder?

cesards commented 7 years ago

Yep. Nothing happens:

RxMDConfiguration rxMDConfiguration = new RxMDConfiguration.Builder(this)
        .setLinkColor(Color.RED)//default color of link text
        .setLinkUnderline(false)//default value of whether displays link underline
        .build();

    RxMarkdown.with(newsItemUI.getText(), this)
        .config(rxMDConfiguration)
        .factory(TextFactory.create())
        .intoObservable()
        .subscribeOn(Schedulers.computation())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(new Subscriber<CharSequence>() {
          @Override
          public void onCompleted() { }

          @Override
          public void onError(Throwable e) { }

          @Override
          public void onNext(CharSequence charSequence) {
            view.text.setText(charSequence, TextView.BufferType.SPANNABLE);
          }
        });

where newsItemUI.getText() is:

[PLEASEEEEEE](http://deathstar-qa.herokuapp.com/)

and the output of onNext is:

PLEASEEEEEE
VovaStelmashchuk commented 7 years ago

@cesards Can you attached your xml file and class of your view?

cesards commented 7 years ago

I found the problem!

The problem is related to the flag: android:autoLink="web" because the TextView removes all the Spans, I guess, and it creates its own.

You should mention that in the documentation. Thank you so much, guys!