jasonkneen / ti-html2as

HTML 2 AttributedString converter for Titanium
Other
64 stars 24 forks source link

Android links - underline color #39

Closed Nostariel closed 7 years ago

Nostariel commented 7 years ago

Hi,

I've been working with this module for a while, but now I'm wondering how to change the underline color of an tag on Android.

I just want some part of my string to be a link, but without the underline.

On iOS, I just pass a different color on the value param of ATTRIBUTE_UNDERLINE_COLOR and it works, but on Android it takes the color of the ATTRIBUTE_FOREGROUND_COLOR.

Here's some of the code I'm using on the customMatcher:

if (node.type === 'tag' && node.name && node.name === 'a') {
    parameters.attributes.unshift({
        type : ns.ATTRIBUTE_FOREGROUND_COLOR,
        value : color,
        range : [offset, length]
    });

    parameters.attributes.unshift({
        type : Ti.UI.ATTRIBUTE_UNDERLINE_COLOR,
        value : color2,
        range : [offset, length]
    });

    parameters.attributes.unshift({
        type : Ti.UI.ATTRIBUTE_FONT,
        value : {
            fontFamily: Alloy.Globals.fontMedium,
            fontSize: "12sp"
        },
        range : [offset, length]
    });
}

Is there a way to achieve this?

Thank you very much!

FokkeZB commented 7 years ago

Hi @Nostariel - That's sounds like a parity bug in Titanium then. You might want to report that at jira.appcelerator.org. This module merely parses HTML to attributed strings.