Refactoring

pull/178/head
M66B 5 years ago
parent 5548691e4a
commit 5a9dcd9f87

@ -231,8 +231,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
criteria.with_hidden, criteria.with_hidden,
criteria.with_encrypted, criteria.with_encrypted,
criteria.with_attachments, criteria.with_attachments,
criteria.from, criteria.after,
criteria.to, criteria.before,
SEARCH_LIMIT, state.offset); SEARCH_LIMIT, state.offset);
Log.i("Boundary device folder=" + folder + Log.i("Boundary device folder=" + folder +
" criteria=" + criteria + " criteria=" + criteria +
@ -426,10 +426,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
state.ifolder.getPermanentFlags().contains(Flags.Flag.FLAGGED)) state.ifolder.getPermanentFlags().contains(Flags.Flag.FLAGGED))
and.add(new FlagTerm(new Flags(Flags.Flag.FLAGGED), true)); and.add(new FlagTerm(new Flags(Flags.Flag.FLAGGED), true));
if (criteria.from != null) if (criteria.after != null)
and.add(new ReceivedDateTerm(ComparisonTerm.GT, new Date(criteria.from))); and.add(new ReceivedDateTerm(ComparisonTerm.GT, new Date(criteria.after)));
if (criteria.to != null) if (criteria.before != null)
and.add(new ReceivedDateTerm(ComparisonTerm.LT, new Date(criteria.to))); and.add(new ReceivedDateTerm(ComparisonTerm.LT, new Date(criteria.before)));
SearchTerm term = null; SearchTerm term = null;
@ -625,8 +625,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
boolean with_hidden; boolean with_hidden;
boolean with_encrypted; boolean with_encrypted;
boolean with_attachments; boolean with_attachments;
Long from = null; Long after = null;
Long to = null; Long before = null;
SearchCriteria() { SearchCriteria() {
} }
@ -685,8 +685,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
this.with_hidden == other.with_hidden && this.with_hidden == other.with_hidden &&
this.with_encrypted == other.with_encrypted && this.with_encrypted == other.with_encrypted &&
this.with_attachments == other.with_attachments && this.with_attachments == other.with_attachments &&
Objects.equals(this.from, other.from) && Objects.equals(this.after, other.after) &&
Objects.equals(this.to, other.to)); Objects.equals(this.before, other.before));
} else } else
return false; return false;
} }

@ -296,14 +296,14 @@ public interface DaoMessage {
" AND (NOT :hidden OR NOT ui_snoozed IS NULL)" + " AND (NOT :hidden OR NOT ui_snoozed IS NULL)" +
" AND (NOT :encrypted OR ui_encrypt > 0)" + " AND (NOT :encrypted OR ui_encrypt > 0)" +
" AND (NOT :attachments OR attachments > 0)" + " AND (NOT :attachments OR attachments > 0)" +
" AND (:from IS NULL OR received > :from)" + " AND (:after IS NULL OR received > :after)" +
" AND (:to IS NULL OR received < :to)" + " AND (:before IS NULL OR received < :before)" +
" ORDER BY received DESC" + " ORDER BY received DESC" +
" LIMIT :limit OFFSET :offset") " LIMIT :limit OFFSET :offset")
List<TupleMatch> matchMessages( List<TupleMatch> matchMessages(
Long account, Long folder, String find, Long account, Long folder, String find,
boolean unseen, boolean flagged, boolean hidden, boolean encrypted, boolean attachments, boolean unseen, boolean flagged, boolean hidden, boolean encrypted, boolean attachments,
Long from, Long to, Long after, Long before,
int limit, int offset); int limit, int offset);
@Query("SELECT id" + @Query("SELECT id" +

@ -140,10 +140,10 @@ public class FtsDbHelper extends SQLiteOpenHelper {
select += "account = " + account + " AND "; select += "account = " + account + " AND ";
if (folder != null) if (folder != null)
select += "folder = " + folder + " AND "; select += "folder = " + folder + " AND ";
if (criteria.from != null) if (criteria.after != null)
select += "time > " + criteria.from + " AND "; select += "time > " + criteria.after + " AND ";
if (criteria.to != null) if (criteria.before != null)
select += "time < " + criteria.to + " AND "; select += "time < " + criteria.before + " AND ";
Log.i("FTS select=" + select + " search=" + search); Log.i("FTS select=" + select + " search=" + search);
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();

@ -917,6 +917,8 @@
<string name="title_search_with_hidden">Hidden (on device only)</string> <string name="title_search_with_hidden">Hidden (on device only)</string>
<string name="title_search_with_encrypted">Encrypted (on device only)</string> <string name="title_search_with_encrypted">Encrypted (on device only)</string>
<string name="title_search_with_attachments">With attachments (on device only)</string> <string name="title_search_with_attachments">With attachments (on device only)</string>
<string name="title_search_with_before">Before</string>
<string name="title_search_with_after">After</string>
<string name="title_search_flag_unseen">unread</string> <string name="title_search_flag_unseen">unread</string>
<string name="title_search_flag_flagged">starred</string> <string name="title_search_flag_flagged">starred</string>
<string name="title_search_flag_hidden">hidden</string> <string name="title_search_flag_hidden">hidden</string>

Loading…
Cancel
Save