pull/153/head
M66B 6 years ago
parent 6f8c00c690
commit b0bac1ed77

@ -47,7 +47,6 @@ import android.print.PrintDocumentAdapter;
import android.print.PrintManager; import android.print.PrintManager;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.provider.Settings; import android.provider.Settings;
import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.Layout; import android.text.Layout;
import android.text.Spannable; import android.text.Spannable;
@ -89,7 +88,6 @@ import com.google.android.material.snackbar.Snackbar;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.xml.sax.XMLReader;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
@ -1678,13 +1676,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return image; return image;
} }
}, new Html.TagHandler() { }, null);
@Override
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
//if (BuildConfig.DEBUG)
// Log.i("HTML tag=" + tag + " opening=" + opening);
}
});
} }
private class UrlHandler extends ArrowKeyMovementMethod { private class UrlHandler extends ArrowKeyMovementMethod {

@ -59,7 +59,6 @@ import android.text.TextWatcher;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
import android.text.style.QuoteSpan; import android.text.style.QuoteSpan;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.text.style.TypefaceSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
import android.util.TypedValue; import android.util.TypedValue;
@ -92,7 +91,6 @@ import org.jsoup.nodes.Element;
import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection; import org.openintents.openpgp.util.OpenPgpServiceConnection;
import org.xml.sax.XMLReader;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -2489,42 +2487,6 @@ public class FragmentCompose extends FragmentBase {
} }
}; };
private Html.TagHandler tagHandler = new Html.TagHandler() {
@Override
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
if (tag.equalsIgnoreCase("tt"))
processTt(opening, output);
}
private void processTt(boolean opening, Editable output) {
Log.i("Handling tt");
int len = output.length();
if (opening)
output.setSpan(new TypefaceSpan("monospace"), len, len, Spannable.SPAN_MARK_MARK);
else {
Object span = getLast(output, TypefaceSpan.class);
if (span != null) {
int pos = output.getSpanStart(span);
output.removeSpan(span);
if (pos != len)
output.setSpan(new TypefaceSpan("monospace"), pos, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
private Object getLast(Editable text, Class kind) {
Object[] spans = text.getSpans(0, text.length(), kind);
if (spans.length == 0)
return null;
for (int i = spans.length; i > 0; i--)
if (text.getSpanFlags(spans[i - 1]) == Spannable.SPAN_MARK_MARK)
return spans[i - 1];
return null;
}
};
public class IdentityAdapter extends ArrayAdapter<TupleIdentityEx> { public class IdentityAdapter extends ArrayAdapter<TupleIdentityEx> {
private Context context; private Context context;
private List<TupleIdentityEx> identities; private List<TupleIdentityEx> identities;

Loading…
Cancel
Save