square / phrase

Phrase is an Android string resource templating library
Apache License 2.0
1.4k stars 126 forks source link

Support Spannable for ListPhrase #31

Closed zombispormedio closed 2 years ago

zombispormedio commented 8 years ago
ListPhrase listFormatter = ListPhrase.from(" and ", ", ", and ");

String[] texts=new String[]{"Joe", "Jane", "John"};
ArrayList<CharSequence> bolds=new new ArrayList<>();

for(String t : texts){
     Spannable b = new SpannableString(t);
     boldString.setSpan(new StyleSpan(BOLD), 0, t.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
     bolds.add(b)
}
return listFormatter.join(bolds)

That doesn't show style while Phrase support for Spannable

edenman commented 2 years ago

This is very old, but I think the issue is the toString in formatOrThrow. I don't use ListPhrase but PRs welcome if you want to figure out a fix