You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Add some more methods needed by NewPipe. Mostly stubs
This commit is contained in:
@@ -4,4 +4,19 @@ public class Html {
|
||||
public static Spanned fromHtml(String source) {
|
||||
return new SpannableString(source.replace("<br/>", "\n")); // TODO when JTidy is in use: s/<br \/>//g
|
||||
}
|
||||
|
||||
public static String escapeHtml(CharSequence source) {
|
||||
StringBuilder out = new StringBuilder(source.length());
|
||||
for (int i = 0; i < source.length(); i++) {
|
||||
char c = source.charAt(i);
|
||||
if (c == '<' || c == '>' || c == '&' || c == '"' || c == '\'' || c > 0x7F) {
|
||||
out.append("&#");
|
||||
out.append((int) c);
|
||||
out.append(';');
|
||||
} else {
|
||||
out.append(c);
|
||||
}
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user