|
|
|
@ -21,6 +21,7 @@ import static android.text.Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.graphics.Typeface;
|
|
|
|
|
import android.text.Layout;
|
|
|
|
|
import android.text.Spannable;
|
|
|
|
|
import android.text.SpannableStringBuilder;
|
|
|
|
|
import android.text.Spanned;
|
|
|
|
|
import android.text.TextDirectionHeuristics;
|
|
|
|
@ -43,6 +44,7 @@ import android.text.style.SuperscriptSpan;
|
|
|
|
|
import android.text.style.TypefaceSpan;
|
|
|
|
|
import android.text.style.URLSpan;
|
|
|
|
|
import android.text.style.UnderlineSpan;
|
|
|
|
|
import android.view.inputmethod.BaseInputConnection;
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Array;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -76,8 +78,10 @@ public class HtmlEx {
|
|
|
|
|
* @return string containing input converted to HTML
|
|
|
|
|
*/
|
|
|
|
|
public /* static */ String toHtml(Spanned text, int option) {
|
|
|
|
|
if (!Helper.isUiThread())
|
|
|
|
|
if (!Helper.isUiThread()) {
|
|
|
|
|
text = new SpannableStringBuilderEx(text);
|
|
|
|
|
BaseInputConnection.removeComposingSpans((Spannable) text);
|
|
|
|
|
}
|
|
|
|
|
StringBuilder out = new StringBuilder();
|
|
|
|
|
withinHtml(out, text, option);
|
|
|
|
|
return out.toString();
|
|
|
|
|