Simple task: spanned by value

pull/212/head
M66B 2 years ago
parent 55b97da356
commit 5fb25a708d

@ -78,10 +78,6 @@ public class HtmlEx {
* @return string containing input converted to HTML * @return string containing input converted to HTML
*/ */
public /* static */ String toHtml(Spanned text, int option) { public /* static */ String toHtml(Spanned text, int option) {
if (!Helper.isUiThread()) {
text = new SpannableStringBuilderEx(text);
BaseInputConnection.removeComposingSpans((Spannable) text);
}
StringBuilder out = new StringBuilder(); StringBuilder out = new StringBuilder();
withinHtml(out, text, option); withinHtml(out, text, option);
return out.toString(); return out.toString();

@ -25,6 +25,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import android.text.Spanned;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -167,6 +168,12 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
this.name = name; this.name = name;
this.started = new Date().getTime(); this.started = new Date().getTime();
for (String key : args.keySet()) {
Object value = args.get(key);
if (value instanceof Spanned)
args.putCharSequence(key, new SpannableStringBuilderEx((Spanned) value));
}
if (owner instanceof TwoStateOwner) if (owner instanceof TwoStateOwner)
Log.e(new Throwable("SimpleTask/TwoStateOwner")); Log.e(new Throwable("SimpleTask/TwoStateOwner"));

Loading…
Cancel
Save