修改测试问题,shouye ytuijian

This commit is contained in:
18401019693 2022-08-10 18:05:52 +08:00
parent 0643209e8e
commit 8330d7f808

View File

@ -103,9 +103,21 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
private Spanned userNicenamehighlight(String context, String keyword) {
String keywordHtml1 = "</font><font color='#FF8D41'size='42px'>" + WordsTypeUtil.changeSimplified(keyword) + "</font><font color='#161616'size='42px'>";
//简体
String simplified = WordsTypeUtil.changeSimplified(keyword);
//繁体
String traditional = WordsTypeUtil.changeTraditional(keyword);
String contextHtml = "";
if (TextUtils.equals(simplified, traditional)) {
contextHtml = context.replace(keyword, keywordHtml1);
contextHtml = "<font color='#161616'size='42px'>" + contextHtml + "</font>";
} else {
String keywordHtml2 = "</font><font color='#FF8D41'size='42px'>" + WordsTypeUtil.changeTraditional(keyword) + "</font><font color='#161616'size='42px'>";
String contextHtml = "<font color='#161616'size='42px'>" + context + "</font>";
contextHtml = "<font color='#161616'size='42px'>" + context + "</font>";
contextHtml = contextHtml.replace(WordsTypeUtil.changeSimplified(keyword), keywordHtml1).replace(WordsTypeUtil.changeTraditional(keyword), keywordHtml2);
}
return Html.fromHtml(contextHtml);
}