TEXTVIEWHTML replacement for API2 ?

44 views
Skip to first unread message

roee88

unread,
Jun 6, 2011, 5:32:13 AM6/6/11
to android-appwidget-extensions
Hi,

I can't figure out how to set styled html text in API 2.
I looked at the launcher code and it seems like this feature just got
dropped.
Am I missing something?

Thanks,
Roee.

Florian Sundermann

unread,
Jun 6, 2011, 11:01:13 AM6/6/11
to android-appwid...@googlegroups.com
Hi,

how do you do this with V1? But I guess you are right cause
CharSequences are always transfered as strings...

Does anyone have an idea? (Looking at you Francois)

2011/6/6 roee88 <roe...@gmail.com>:

Ander Web

unread,
Jun 6, 2011, 11:16:57 AM6/6/11
to android-appwid...@googlegroups.com
The onbly way would be creating a new "data type" for the elements, so the launcher can "fromHTML" the Charsequence/String
http://developer.android.com/reference/android/text/Html.html#fromHtml(java.lang.String)

Not sure about performance/memory/security issues with this implementation, but is the only one I know of.
Message has been deleted

roee88

unread,
Jun 6, 2011, 1:10:38 PM6/6/11
to android-appwidget-extensions
>> Florian Sundermann
On API V1 you just set the view type as
LauncherIntent.Extra.Scroll.Types.TEXTVIEWHTML and make sure the
cursor at the specified index returns HTML encoded string (You can use
Html.toHtml or directly add html tags to your string).

>> Ander Web
setBoundString is used for strings, What's the current use of
setBoundCharSequence?

Florian Sundermann

unread,
Jun 7, 2011, 4:21:55 PM6/7/11
to android-appwid...@googlegroups.com
the main problem here is that the cursor classes don't support
"CharSequence" so you can't use setBoundCharSequence to transfer
"Spanned" objects... So I guess we will have to change the API if we
want to allow this...
But I guess it could be a security issue if we use "fromHTML" cause
the widget could set a link to some resources which may be called in
the context of the launcher... And I don't know what will happen to
embedded javascript...

--
Florian

2011/6/6 roee88 <roe...@gmail.com>:

Francois DESLANDES

unread,
Jun 7, 2011, 4:56:53 PM6/7/11
to android-appwid...@googlegroups.com
Florian, I think the html renderer of TextView with fromHtml is very basic (check the code on ASOP) and will never support javascript or such things.

I use SpannedString very often and supported html tags are VERY limited :/


2011/6/7 Florian Sundermann <boom...@googlemail.com>



--
Francois Deslandes @ Pure widgets - Android widgets

Florian Sundermann

unread,
Jul 27, 2011, 1:33:54 AM7/27/11
to android-appwid...@googlegroups.com
Hi everyone, I've just committed a patch to the testing Branch to add
"setBoundSpanned" and "setSpanned" it also calls "API V3" now cause a
v2 launcher would not be able to work with this commands and I guess
it would FC!

Regards
Florian

2011/6/7 Francois DESLANDES <kox...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages