mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Added search for messages with a local note
This commit is contained in:
@@ -278,6 +278,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
criteria.with_hidden,
|
||||
criteria.with_encrypted,
|
||||
criteria.with_attachments,
|
||||
criteria.with_notes,
|
||||
criteria.with_types == null ? 0 : criteria.with_types.length,
|
||||
criteria.with_types == null ? new String[]{} : criteria.with_types,
|
||||
criteria.with_size,
|
||||
@@ -682,6 +683,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
boolean with_hidden;
|
||||
boolean with_encrypted;
|
||||
boolean with_attachments;
|
||||
boolean with_notes;
|
||||
String[] with_types;
|
||||
Integer with_size = null;
|
||||
Long after = null;
|
||||
@@ -843,6 +845,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
flags.add(context.getString(R.string.title_search_flag_encrypted));
|
||||
if (with_attachments)
|
||||
flags.add(context.getString(R.string.title_search_flag_attachments));
|
||||
if (with_notes)
|
||||
flags.add(context.getString(R.string.title_search_flag_notes));
|
||||
if (with_types != null)
|
||||
if (with_types.length == 1 && "text/calendar".equals(with_types[0]))
|
||||
flags.add(context.getString(R.string.title_search_flag_invite));
|
||||
@@ -872,6 +876,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
this.with_hidden == other.with_hidden &&
|
||||
this.with_encrypted == other.with_encrypted &&
|
||||
this.with_attachments == other.with_attachments &&
|
||||
this.with_notes == other.with_notes &&
|
||||
Arrays.equals(this.with_types, other.with_types) &&
|
||||
Objects.equals(this.with_size, other.with_size) &&
|
||||
Objects.equals(this.after, other.after) &&
|
||||
@@ -895,7 +900,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
" flagged=" + with_flagged +
|
||||
" hidden=" + with_hidden +
|
||||
" encrypted=" + with_encrypted +
|
||||
" attachments=" + with_attachments +
|
||||
" w/attachments=" + with_attachments +
|
||||
" w/notes=" + with_notes +
|
||||
" type=" + (with_types == null ? null : TextUtils.join(",", with_types)) +
|
||||
" size=" + with_size +
|
||||
" after=" + (after == null ? "" : new Date(after)) +
|
||||
|
||||
@@ -332,7 +332,8 @@ public interface DaoMessage {
|
||||
" AND (NOT :flagged OR ui_flagged)" +
|
||||
" AND (NOT :hidden OR NOT ui_snoozed IS NULL)" +
|
||||
" AND (NOT :encrypted OR ui_encrypt > 0)" +
|
||||
" AND (NOT :attachments OR attachments > 0)" +
|
||||
" AND (NOT :with_attachments OR attachments > 0)" +
|
||||
" AND (NOT :with_notes OR NOT `notes` IS NULL)" +
|
||||
" AND (:type_count = 0 OR attachment.type IN (:types))" +
|
||||
" AND (:size IS NULL OR total > :size)" +
|
||||
" AND (:after IS NULL OR received > :after)" +
|
||||
@@ -343,7 +344,7 @@ public interface DaoMessage {
|
||||
List<TupleMatch> matchMessages(
|
||||
Long account, Long folder, String find,
|
||||
boolean senders, boolean recipients, boolean subject, boolean keywords, boolean message, boolean notes,
|
||||
boolean unseen, boolean flagged, boolean hidden, boolean encrypted, boolean attachments,
|
||||
boolean unseen, boolean flagged, boolean hidden, boolean encrypted, boolean with_attachments, boolean with_notes,
|
||||
int type_count, String[] types,
|
||||
Integer size,
|
||||
Long after, Long before,
|
||||
|
||||
@@ -79,6 +79,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_search, null);
|
||||
|
||||
final AutoCompleteTextView etQuery = dview.findViewById(R.id.etQuery);
|
||||
final ImageButton ibNotes = dview.findViewById(R.id.ibNotes);
|
||||
final ImageButton ibAttachment = dview.findViewById(R.id.ibAttachment);
|
||||
final ImageButton ibEvent = dview.findViewById(R.id.ibInvite);
|
||||
final ImageButton ibUnseen = dview.findViewById(R.id.ibUnseen);
|
||||
@@ -388,16 +389,17 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||
|
||||
BoundaryCallbackMessages.SearchCriteria criteria = new BoundaryCallbackMessages.SearchCriteria();
|
||||
int id = v.getId();
|
||||
if (id == R.id.ibAttachment) {
|
||||
if (id == R.id.ibNotes)
|
||||
criteria.with_notes = true;
|
||||
else if (id == R.id.ibAttachment)
|
||||
criteria.with_attachments = true;
|
||||
} else if (id == R.id.ibInvite) {
|
||||
else if (id == R.id.ibInvite) {
|
||||
criteria.with_attachments = true;
|
||||
criteria.with_types = new String[]{"text/calendar"};
|
||||
} else if (id == R.id.ibUnseen) {
|
||||
} else if (id == R.id.ibUnseen)
|
||||
criteria.with_unseen = true;
|
||||
} else if (id == R.id.ibFlagged) {
|
||||
else if (id == R.id.ibFlagged)
|
||||
criteria.with_flagged = true;
|
||||
}
|
||||
|
||||
FragmentMessages.search(
|
||||
context, getViewLifecycleOwner(), getParentFragmentManager(),
|
||||
@@ -405,6 +407,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||
}
|
||||
};
|
||||
|
||||
ibNotes.setOnClickListener(onClick);
|
||||
ibAttachment.setOnClickListener(onClick);
|
||||
ibEvent.setOnClickListener(onClick);
|
||||
ibUnseen.setOnClickListener(onClick);
|
||||
|
||||
@@ -1138,6 +1138,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
if (criteria.with_hidden ||
|
||||
criteria.with_encrypted ||
|
||||
criteria.with_attachments ||
|
||||
criteria.with_notes ||
|
||||
criteria.with_types != null)
|
||||
fabSearch.hide();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user