1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Refactoring

This commit is contained in:
M66B 2021-03-15 09:05:54 +01:00
parent f8264e6754
commit cbfed68c6b

View file

@ -301,24 +301,26 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
state.index = i + 1;
TupleMatch match = state.matches.get(i);
if (criteria.query != null &&
criteria.in_message &&
(match.matched == null || !match.matched))
try {
File file = EntityMessage.getFile(context, match.id);
if (file.exists()) {
String html = Helper.readText(file);
if (html.toLowerCase().contains(criteria.query)) {
String text = HtmlHelper.getFullText(html);
if (text.toLowerCase().contains(criteria.query))
match.matched = true;
}
}
} catch (IOException ex) {
Log.e(ex);
}
boolean matched = (match.matched != null && match.matched);
if (match.matched != null && match.matched) {
if (criteria.query != null) {
if (!matched && criteria.in_message)
try {
File file = EntityMessage.getFile(context, match.id);
if (file.exists()) {
String html = Helper.readText(file);
if (html.toLowerCase().contains(criteria.query)) {
String text = HtmlHelper.getFullText(html);
if (text.toLowerCase().contains(criteria.query))
matched = true;
}
}
} catch (IOException ex) {
Log.e(ex);
}
}
if (matched) {
found++;
Log.i("Boundary matched=" + match.id);
db.message().setMessageFound(match.id);