Merge change 7514 into donut
* changes: Only parse search suggestions that look like HTML
This commit is contained in:
@@ -351,7 +351,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
|
|||||||
CharSequence text = null;
|
CharSequence text = null;
|
||||||
if (textCol >= 0) {
|
if (textCol >= 0) {
|
||||||
String str = cursor.getString(textCol);
|
String str = cursor.getString(textCol);
|
||||||
if (isHtml && !TextUtils.isEmpty(str)) {
|
if (isHtml && looksLikeHtml(str)) {
|
||||||
text = Html.fromHtml(str);
|
text = Html.fromHtml(str);
|
||||||
} else {
|
} else {
|
||||||
text = str;
|
text = str;
|
||||||
@@ -367,6 +367,15 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean looksLikeHtml(String str) {
|
||||||
|
if (TextUtils.isEmpty(str)) return false;
|
||||||
|
for (int i = str.length() - 1; i >= 0; i--) {
|
||||||
|
char c = str.charAt(i);
|
||||||
|
if (c == '<' || c == '&') return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getIcon1(Cursor cursor) {
|
private Drawable getIcon1(Cursor cursor) {
|
||||||
if (mIconName1Col < 0) {
|
if (mIconName1Col < 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user