mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Cleanup
This commit is contained in:
@@ -1851,7 +1851,7 @@ public class HtmlHelper {
|
||||
|
||||
truncate(d, true);
|
||||
|
||||
SpannableStringBuilder ssb = fromDocument(context, d, true, null, null);
|
||||
SpannableStringBuilder ssb = fromDocument(context, d, null, null);
|
||||
|
||||
for (URLSpan span : ssb.getSpans(0, ssb.length(), URLSpan.class)) {
|
||||
String url = span.getURL();
|
||||
@@ -2000,7 +2000,7 @@ public class HtmlHelper {
|
||||
}
|
||||
|
||||
static SpannableStringBuilder fromDocument(
|
||||
Context context, @NonNull Document document, boolean compress,
|
||||
Context context, @NonNull Document document,
|
||||
@Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean debug = prefs.getBoolean("debug", false);
|
||||
@@ -2468,25 +2468,6 @@ public class HtmlHelper {
|
||||
else
|
||||
Log.e("Invalid span " + start + "..." + end + " len=" + len + " type=" + span.getClass().getName());
|
||||
}
|
||||
|
||||
private void newline(int index) {
|
||||
int count = 0;
|
||||
|
||||
if (compress) {
|
||||
int i = Math.min(index, ssb.length() - 1);
|
||||
while (i >= 0) {
|
||||
char kar = ssb.charAt(i);
|
||||
if (kar == '\n')
|
||||
count++;
|
||||
else if (kar != ' ' && kar != '\u00A0')
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (count < 2)
|
||||
ssb.insert(index, "\n");
|
||||
}
|
||||
}, document.body());
|
||||
|
||||
if (debug)
|
||||
@@ -2529,13 +2510,13 @@ public class HtmlHelper {
|
||||
return ssb;
|
||||
}
|
||||
|
||||
static Spanned fromHtml(@NonNull String html, boolean compress, Context context) {
|
||||
return fromHtml(html, compress, null, null, context);
|
||||
static Spanned fromHtml(@NonNull String html, Context context) {
|
||||
return fromHtml(html, null, null, context);
|
||||
}
|
||||
|
||||
static Spanned fromHtml(@NonNull String html, boolean compress, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler, Context context) {
|
||||
static Spanned fromHtml(@NonNull String html, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler, Context context) {
|
||||
Document document = JsoupEx.parse(html);
|
||||
return fromDocument(context, document, compress, imageGetter, tagHandler);
|
||||
return fromDocument(context, document, imageGetter, tagHandler);
|
||||
}
|
||||
|
||||
static String toHtml(Spanned spanned, Context context) {
|
||||
|
||||
Reference in New Issue
Block a user