Refactoring

pull/194/head
M66B 4 years ago
parent f8264e6754
commit cbfed68c6b

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

Loading…
Cancel
Save